请教:如何在程序里判断我“按下鼠标右键”?
本帖最后由 作者 于 2005-8-17 15:36:32 编辑请问,如何在程序里判断我“按下鼠标右键”?通过这样的判断我可以从某个过程中退出来 <P>难道这是个很难的问题吗?</P>
<P>怎么没有人回答呀</P> 按下右键会产生一个错误,通过捕获错误号知道。具体这方面的源代码网站上有,你搜索一下。 <P>参考一下:</P>
<P> </P>
<P>Public Function ClickConfirm() As Boolean<BR> Dim objUtil As AcadUtility<BR> Dim varPnt As Variant<BR> Dim strPrmt As String<BR> On Error GoTo Err_Control<BR> ‘strPrmt = "Left click to confirm, right click to cancel"<BR> strPrmt = "鼠标左键确认,右键取消"<BR> Set objUtil = ThisDrawing.Utility<BR> varPnt = objUtil.GetPoint(Prompt:=strPrmt)<BR> 'No error? Then they "left clicked" (or typed a point on<BR> 'The command line. Meh. Users are crazy.<BR> ClickConfirm = True<BR>Exit_Here:<BR> Exit Function<BR>Err_Control:<BR> 'Debug.Print Err.Description; Err.Number<BR> Select Case Err.Number<BR> Case -2145320928<BR> 'Right click with command prompt or "Enter" key<BR> 'User input is a keyword<BR> Err.Clear<BR> Resume Exit_Here<BR> Case -2147352567<BR> 'User pressed escape or clicked a toolbar<BR> 'Method 'GetPoint' of object 'IAcadUtility' failed<BR> Err.Clear<BR> Resume Exit_Here<BR> Case Else<BR> Err.Clear<BR> Resume Exit_Here<BR> End Select<BR>End Function <BR>功能 <BR>实现鼠标左键确认,右键取消功能 <BR>语法 <BR>ClickConfirm() <BR>返回值 <BR>True为按了左键</P> <P>谢谢你们,我马上去搞一下。</P>
页:
[1]