My Question(200分)

  • 主题发起人 主题发起人 zzhzzh
  • 开始时间 开始时间
Z

zzhzzh

Unregistered / Unconfirmed
GUEST, unregistred user!
There is a TListbox control in the form of my application. when
an item of the control is selected at run time, A focus rect
appears around the item.
My question is:
How can I avoid the appearance of the focus rect? and my
function,
ListBox1.Canvas.DrawFocusRect(InflateRect(ListBox1.ItemRect(ListBox1.ItemIndex),0,-20)),don't work,why?
Thank you!!!!!
 
http://www.gislab.ecnu.edu.cn/delphibbs/DispQ.asp?LID=193211
can you read chinese?
 
你是在哪里调用这个函数的?ListBox有默认的行为,如果要自己处理重绘的话就把ListBox设置为OwnerDraw风格.
 
你是不想它有焦点吧,其实它可以没有焦点的,
我没有试过点击以后,会怎么样。
 
Please give me source code!!!!!
Thank you!!!!!!!!!
 
按照你们的回答去做,还是行不通
 
cakk的解答:
重写
procedure TCustomListBox.CNDrawItem(var Message: TWMDrawItem);
把这句去掉就可以了:
if odFocused in State then DrawFocusRect(hDC, rcItem);
 
多人接受答案了。
 
后退
顶部