有关ListBox的选项的选择(Selected反色)问题。怎样不用鼠标通过程序来使ListBox中的选项反色?或在点鼠标右键时使之被选(一般是左键点下时为选定

C

cjh_xf

Unregistered / Unconfirmed
GUEST, unregistred user!
有关ListBox的选项的选择(Selected反色)问题。怎样不用鼠标通过程序来使ListBox中的选项反色?或在点鼠标右键时使之被选(一般是左键点下时为选定)?本人只有21分了,不要嫌少拉,以后补上:)(21分)<br />我想在程序中利用代码实现listbox的选择,要listbox中被选的选项成反色,不知怎么去实现!或者在鼠标右键点下时选定?该怎么去实现?
 
这样

procedure TForm1.ListBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var item:integer;
begin
item:=listbox1.ItemAtPos(point(x,y),true);
if item=-1 then exit;
if ssright in shift then listbox1.Selected[item]:=true;
end;


-----------------------------
http://www.tommstudio.com/
 
处理消息,让右键变成左键!
 
接受答案了.
 
顶部