请问如何得知鼠标移到一个TListBox中的item之上? 自己定义一个类,派生自TCustomBox,然后自绘其中的项目。我现在想让鼠标移到一个项目上的时候让这行变色显示,请问要如何才能捕获此事件? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 根据font.height,pointer(x,y),scrollbox的position计算。 onmousemove事件ListBox1.ItemAtPos() (*//声明: 本人保证所提供的方法是所知的最好方法 解答问题纯属公益性质 所以请不要向我追问 如果有时间自会关注后续问题分析:<NULL>问题:如何通过坐标确定TListBox项的序号?设计:Zswang日期:2002-10-08方案:使用TListBox.ItemAtPos()方法//*)procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin TListBox(Sender).ItemIndex := TListBox(Sender).ItemAtPos(Point(X, Y), True);// Caption := IntToStr(TListBox(Sender).ItemAtPos(Point(X, Y), True)); //tryend; procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var p:tpoint; begin p.x:=x; p.y:=y; if listbox1.ItemAtPos(p,true)>-1 then showmessage('当前位置'+inttostr(listbox1.itematpos(p,true)));end; 这个复杂的sql语句怎么写呢? 请问怎么给Panel设置图形背景? adoconnection的问题 真心求教,如何动态的调用dll中的窗体类 请问formclose,formclosequery有何区别吗? dll如何以索引号输出函数? 用过dxdbgrid的朋友请进!!急!!! 如何使PageControl转到指定的页? 本人认真的在对比了,人气,招聘,未来趋势。觉得java+sql才是入门者的最佳选择。 如何判断query中的数据已经被修改 哪里有delphi6 SP2 下载? 高手请进,关于CELL控件!
ListBox1.ItemAtPos()
声明:
本人保证所提供的方法是所知的最好方法
解答问题纯属公益性质
所以请不要向我追问
如果有时间自会关注后续问题
分析:<NULL>
问题:如何通过坐标确定TListBox项的序号?
设计:Zswang
日期:2002-10-08
方案:使用TListBox.ItemAtPos()方法
//*)procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
TListBox(Sender).ItemIndex := TListBox(Sender).ItemAtPos(Point(X, Y), True);
// Caption := IntToStr(TListBox(Sender).ItemAtPos(Point(X, Y), True)); //try
end;
Y: Integer);
var
p:tpoint;
begin
p.x:=x;
p.y:=y;
if listbox1.ItemAtPos(p,true)>-1 then
showmessage('当前位置'+inttostr(listbox1.itematpos(p,true)));
end;