夫 夫罗多 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-25 #1 指定窗体里的按钮没有HANDLE,只知道它所在的坐标范围,如何得到在指定位置按下鼠标的信息呢?本人新手,请贴代码,谢谢!<br><br>就是这样的代码(比如5没有HANDLE 只能通过区域来判断)监视鼠标在计算器上"5"的位置按下左键 的程序代码 只要在5的位置按下左键就ShowMessage()
指定窗体里的按钮没有HANDLE,只知道它所在的坐标范围,如何得到在指定位置按下鼠标的信息呢?本人新手,请贴代码,谢谢!<br><br>就是这样的代码(比如5没有HANDLE 只能通过区域来判断)监视鼠标在计算器上"5"的位置按下左键 的程序代码 只要在5的位置按下左键就ShowMessage()
8 8525310 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-25 #2 用鼠标单击事件试试,然后,判断范围。代码。希望还是你自己解决,我也很懒的。呵呵
X xiammy Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #4 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>var<br> rRect: TRect;<br>begin<br> rRect := Rect(10, 10, 100, 100);<br> if (X > rRect.Left) and (X < rRect.Right)<br> and (Y > rRect.Top) and ( Y < rRect.Bottom) then<br> begin<br> ShowMessage('Ok');<br> end;<br>end;<br>本来想对代码解释一下,看了一下,真看不出为什么腰写出这些代码!<br><br>唉,DFW的未来在哪里?
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>var<br> rRect: TRect;<br>begin<br> rRect := Rect(10, 10, 100, 100);<br> if (X > rRect.Left) and (X < rRect.Right)<br> and (Y > rRect.Top) and ( Y < rRect.Bottom) then<br> begin<br> ShowMessage('Ok');<br> end;<br>end;<br>本来想对代码解释一下,看了一下,真看不出为什么腰写出这些代码!<br><br>唉,DFW的未来在哪里?
魔 魔鬼大师 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #7 rRect := Form.Rect;<br> if (X > rRect.Left) and (X < rRect.Right)<br> and (Y > rRect.Top) and ( Y < rRect.Bottom) then<br> begin<br> ShowMessage('Ok');<br> end;
rRect := Form.Rect;<br> if (X > rRect.Left) and (X < rRect.Right)<br> and (Y > rRect.Top) and ( Y < rRect.Bottom) then<br> begin<br> ShowMessage('Ok');<br> end;
魔 魔鬼大师 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #8 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button=left begin<br> ShowMessage('left btn press');<br> end;<br>end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button=left begin<br> ShowMessage('left btn press');<br> end;<br>end;
J jimzhao Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #9 //改一下楼上的:)<br>procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('mouse left btn press');<br>end;
//改一下楼上的:)<br>procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('mouse left btn press');<br>end;
D dongy_143 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #11 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>var<br> rRect: TRect;<br>begin<br> rRect := Rect(10, 10, 100, 100); //里面的四个参数,前两个是窗体(注意不是屏幕)的左上角的x,y后两个是右下角的x,y;你可以自己定区域的<br> if (X > rRect.Left) and (X < rRect.Right)<br> and (Y > rRect.Top) and ( Y < rRect.Bottom) then<br> begin<br> ShowMessage('Ok');<br> end;<br>end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>var<br> rRect: TRect;<br>begin<br> rRect := Rect(10, 10, 100, 100); //里面的四个参数,前两个是窗体(注意不是屏幕)的左上角的x,y后两个是右下角的x,y;你可以自己定区域的<br> if (X > rRect.Left) and (X < rRect.Right)<br> and (Y > rRect.Top) and ( Y < rRect.Bottom) then<br> begin<br> ShowMessage('Ok');<br> end;<br>end;
魔 魔鬼大师 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #12 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('mouse left button pressed');<br>end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('mouse left button pressed');<br>end;
Z zj_mpy Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #14 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button=left begin<br> ShowMessage('left btn press');<br> end;<br>end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button=left begin<br> ShowMessage('left btn press');<br> end;<br>end;
O oupj Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #16 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('左键');<br> if Button = mbRight then<br> ShowMessage('右键');<br>end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('左键');<br> if Button = mbRight then<br> ShowMessage('右键');<br>end;
魔 魔鬼大师 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-26 #17 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('Left');<br> if Button = mbRight then<br> ShowMessage('Right');<br>end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> if Button = mbLeft then<br> ShowMessage('Left');<br> if Button = mbRight then<br> ShowMessage('Right');<br>end;