代码:
Private Sub Form_Click()
Dim PixelTop As Integer, PixelLeft As Integer
Dim PixelWidth As Integer, PixelHeight As Integer
PixelTop = Me.Top / Screen.TwipsPerPixelY
PixelLeft = Me.Left / Screen.TwipsPerPixelX
PixelHeight = Me.Height / Screen.TwipsPerPixelY
PixelWidth = Me.Width / Screen.TwipsPerPixelX
Print "距离上方" & CStr(PixelTop) & "Pixels"
Print "距离左方" & CStr(PixelLeft) & "Pixels"
Print "高" & CStr(PixelHeight) & "Pixels"
Print "宽" & CStr(PixelWidth) & "Pixels"
End Sub
--------------------------------------------------------------------
Made by Thirdapple's Studio(http://3rdapple.51.net/)
Private Sub Form_Click()
Dim PixelTop As Integer, PixelLeft As Integer
Dim PixelWidth As Integer, PixelHeight As Integer
PixelTop = Me.Top / Screen.TwipsPerPixelY
PixelLeft = Me.Left / Screen.TwipsPerPixelX
PixelHeight = Me.Height / Screen.TwipsPerPixelY
PixelWidth = Me.Width / Screen.TwipsPerPixelX
Print "距离上方" & CStr(PixelTop) & "Pixels"
Print "距离左方" & CStr(PixelLeft) & "Pixels"
Print "高" & CStr(PixelHeight) & "Pixels"
Print "宽" & CStr(PixelWidth) & "Pixels"
End Sub
--------------------------------------------------------------------
Made by Thirdapple's Studio(http://3rdapple.51.net/)
Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
说明
改变指定窗口的位置和大小。顶级窗口可能受最大或最小尺寸的限制,那些尺寸优先于这里设置的参数
返回值
Long,非零表示成功,零表示失败
参数表
参数 类型及说明
hwnd Long,欲移动窗口的句柄
x Long,窗口新的左侧位置
y Long,窗口新的顶部位置
nWidth Long,窗口的新宽度
nHeight Long,窗口的高宽度
bRepaint Long,如窗口此时应重画,则设为TRUE(非零)。FALSE(零)则表明应用程序会自己决定是否重画窗口