在第个Mousedown中写,不知道有没有更好的方法
解决方案 »
- 想读取二进制文件指定位置怎么实现啊?
- 关于ACCESS表小数位数的问题!!高分!!!!赶工程,分不够再加!!!!!
- 一个关于窗体前置的问题!很简单的!
- 新手请教小问题:)
- 老问题:怎样用AdoQuery往SqlServer中保存Word文件?我试了,老出错。在线等待!!多谢!!
- ADODataSet.Parameters.Clear和ADODataSet.Parameters.Refresh的用法
- 今天三喜临门,散分。
- WinSocket的SendBuf(var buf,Count: Integer): Integer其中count和返回值的意义,move用法
- 请问为什么api函数rectangle只能调用一次?
- 程序因ehlib评估版问题而不能运行
- 救救小弟,请看看这个函数,
- SQL.Text := 'select top 1 * from zhu';//为什么这个模块需要把头一位的资料拉出来
begin
if Key = #13 then ListBox1.Visible :3D true;
end;procedure TForm1.ListBox1Exit(Sender: TObject);
begin
(Sender as TListBox).Visible := false;
end;
—————————————————————————————————
MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
毁誉由人,望天上云卷云舒,聚散任风。';
if Not Assigned(I) then
I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '假如上述代码中出现“OA”、“3D”等字样,改为“=”等';
I.Desire := '加不加分随你';
—————————————————————————————————
当在ListBox以外点击鼠标时不一定会触发ListBox.OnExit:
1.在Edit中敲回车时,ListBox只是显示出来,并没有得到焦点,这时将焦点切换到其它控件时不会触发ListBox.OnExit;
2.Shape是个GraphicControl,而且它的父控件Panel也不会得到输入焦点,当在这两个控件中点击时不会触发ListBox.OnExit.
只能用OnMouseDown来作:
procedure TForm1.OtherMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button := mbLeft then
ListBox1.Visible := false;
end;
把Edit,Panel和Shape的OnMouseDown都设为OtherMouseDown.
不过搂主说:
鼠标单击listbox以外的任何地方,让已经显示的listbox的visible=false
所以你的“把Edit,Panel和Shape的OnMouseDown都设为OtherMouseDown.”其实是不严谨的。我看这样:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
ListBox1.Visible := true;
ListBox1.SetFocus;
end;
end;procedure TForm1.ListBox1Exit(Sender: TObject);
begin
(Sender as TListBox).Visible := false;
end;你们以为如何?
—————————————————————————————————
MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
毁誉由人,望天上云卷云舒,聚散任风。';
if Not Assigned(I) then
I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '假如上述代码中出现“OA”、“3D”等字样,改为“=”或者去掉';
I.Desire := '加不加分随你';
—————————————————————————————————