怎样更改VB窗体坐标?
3个回答
展开全部
刚学VB时写的一个自建坐标系的例子
Private Sub Form_load()
Me.Height = Me.Width
End Sub
Private Sub Form_Resize()
With Picture1
.Picture = LoadPicture()
.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
.ScaleMode = 0 'ScaleMode为0时使用自定义坐标系
.ScaleLeft = 0 'ScaleLeft和ScaleTOP定义左上角的坐标
.ScaleTop = 10
'Picture1.Scale (0, 10)-(10, 0)
'效果与ScaleLeft + ScaleTop相同
.ScaleWidth = 10
.ScaleHeight = -10
'ScaleWidth和ScaleHeight定义坐标的范围
'值为正数时,坐标系X轴(Y轴)的正方向为从左到右(从上到下)
'为负数时相反
.AutoRedraw = True
.ForeColor = &HFFFFFF
.Cls
For i = 1 To 9
Picture1.Line (i, 0)-(i, 10), &H808080
Picture1.Line (0, i)-(10, i), &H808080
Next i
.Picture = .Image
End With
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Cls
Picture1.Line (Fix(X), Fix(Y))-(Fix(X) + 1, Fix(Y) + 1), &H808080, BF
Picture1.PSet (Fix(X), Fix(Y) + 1), &H808080
'PSet是为了让Print出的文字显示到合适的位置上
Picture1.Print "(" & Fix(X) & "," & Fix(Y) & ")"
End Sub
Private Sub Form_load()
Me.Height = Me.Width
End Sub
Private Sub Form_Resize()
With Picture1
.Picture = LoadPicture()
.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
.ScaleMode = 0 'ScaleMode为0时使用自定义坐标系
.ScaleLeft = 0 'ScaleLeft和ScaleTOP定义左上角的坐标
.ScaleTop = 10
'Picture1.Scale (0, 10)-(10, 0)
'效果与ScaleLeft + ScaleTop相同
.ScaleWidth = 10
.ScaleHeight = -10
'ScaleWidth和ScaleHeight定义坐标的范围
'值为正数时,坐标系X轴(Y轴)的正方向为从左到右(从上到下)
'为负数时相反
.AutoRedraw = True
.ForeColor = &HFFFFFF
.Cls
For i = 1 To 9
Picture1.Line (i, 0)-(i, 10), &H808080
Picture1.Line (0, i)-(10, i), &H808080
Next i
.Picture = .Image
End With
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.Cls
Picture1.Line (Fix(X), Fix(Y))-(Fix(X) + 1, Fix(Y) + 1), &H808080, BF
Picture1.PSet (Fix(X), Fix(Y) + 1), &H808080
'PSet是为了让Print出的文字显示到合适的位置上
Picture1.Print "(" & Fix(X) & "," & Fix(Y) & ")"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
sub change()
窗体名称.left=screen.width-窗体名称.width-x
窗体名称.top=screen.height-窗体名称.height-y
end sub
然后 x,y就是窗体右下角坐标
窗体名称.left=screen.width-窗体名称.width-x
窗体名称.top=screen.height-窗体名称.height-y
end sub
然后 x,y就是窗体右下角坐标
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用如下语句:
Me.Scale (Me.Width, Me.Height)-(0, 0)
Me.Scale (Me.Width, Me.Height)-(0, 0)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询