VB的问题,谁能帮我解释一下这两段代码什么意思吗?
OptionExplicitPrivateTypeMYPOINTxAsSingleyAsSingleEndTypePrivateTypeRECTLeftAsLongTop...
Option Explicit
Private Type MYPOINT
x As Single
y As Single
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Sub GetClientRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT)
Const PI = 3.1415926
中间是主程序
Private Sub Form_Load()
Dim rt As RECT
GetClientRect Me.hwnd, rt
Dim wh As Single
wh = (rt.Right - rt.Left) / (rt.Bottom - rt.Top)
Me.Scale (-100 * wh, 100)-(100 * wh, -100)
End Sub
最好逐句帮我翻译一下,要答辩我不懂的话很难通过 展开
Private Type MYPOINT
x As Single
y As Single
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Sub GetClientRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT)
Const PI = 3.1415926
中间是主程序
Private Sub Form_Load()
Dim rt As RECT
GetClientRect Me.hwnd, rt
Dim wh As Single
wh = (rt.Right - rt.Left) / (rt.Bottom - rt.Top)
Me.Scale (-100 * wh, 100)-(100 * wh, -100)
End Sub
最好逐句帮我翻译一下,要答辩我不懂的话很难通过 展开
1个回答
展开全部
Option Explicit '这个是规范所有变量都要定义才能用
Private Type MYPOINT '定义一个数据类型MYPOINT,包括x,y
x As Single
y As Single
End Type
Private Type RECT '定义一个数据类型RECT ,
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
'下边是API,作用是获取hwnd窗体的位置
Private Declare Sub GetClientRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT)
Const PI = 3.1415926 '定义常量 圆周率
中间是主程序
Private Sub Form_Load() '窗体加载
Dim rt As RECT '变量定义
GetClientRect Me.hwnd, rt '获取自身的位置
Dim wh As Single
wh = (rt.Right - rt.Left) / (rt.Bottom - rt.Top) ’计算宽/高的比例
Me.Scale (-100 * wh, 100)-(100 * wh, -100) ‘调整窗体的坐标系统
End Sub
Private Type MYPOINT '定义一个数据类型MYPOINT,包括x,y
x As Single
y As Single
End Type
Private Type RECT '定义一个数据类型RECT ,
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
'下边是API,作用是获取hwnd窗体的位置
Private Declare Sub GetClientRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT)
Const PI = 3.1415926 '定义常量 圆周率
中间是主程序
Private Sub Form_Load() '窗体加载
Dim rt As RECT '变量定义
GetClientRect Me.hwnd, rt '获取自身的位置
Dim wh As Single
wh = (rt.Right - rt.Left) / (rt.Bottom - rt.Top) ’计算宽/高的比例
Me.Scale (-100 * wh, 100)-(100 * wh, -100) ‘调整窗体的坐标系统
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询