标题: [已解决] 关于如何获取控件在屏幕中的实际坐标问题 [打印本页] 作者: eyewitnes 时间: 2008-4-4 11:23 标题: [已解决] 关于如何获取控件在屏幕中的实际坐标问题 在旧贴中搜索到可以使用ME.COMMAND0.TOP和ME.COMMAND0.LEFT
可是在我使用的时候提示应用程序定义或对象定义错误是怎么回事?
Dim Frm As Form
Dim Ctl As Control
Dim frmLeft As Long
Dim frmTop As Long
Set Frm = Screen.ActiveForm
Set Ctl = Screen.ActiveControl
Debug.Print Ctl.Height
Debug.Print Frm.WindowTop
Debug.Print Ctl.Top
Debug.Print Frm.command0.Top-----运行到此行出错
Private Declare Sub SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long