菜鸟问题:窗体上控件size,坐标定位的问题。程序刚运行起来的时候,控件大小好像是像素为单位,比如1024*600,但调整一下尺寸以后,就是很大的值了

BlueLoves 2009-07-14 12:03:39
菜鸟问题:窗体上控件size,坐标定位的问题。程序刚运行起来的时候,控件大小好像是像素为单位,比如1024*600,但调整一下尺寸以后,就是很大的值了,远超这个值。:(

写了个小程序,运行时,控件定位设置坐标的时候,出现问题。在双击一个picturebox1之后,窗体全屏。再双击,恢复全屏之前的样子时,设置它的大小就怎么也不对了。

Private Sub MyFullScreen()
If (bFull) Then
' 如果是需要全屏,则
Me.BorderStyle = 0
Me.Caption = ""
Me.WindowState = 0
Me.Top = 0
Me.Left = 0
Me.Width = Screen.Width '这样设置宽度高度不对?
Me.Height = Screen.Height

Picture_PlayerWnd.Width = Me.Width '这样设置宽度高度总不对!不知道要怎么换算???
Picture_PlayerWnd.Height = Me.Height

Else
Me.BorderStyle = 2
Me.Caption = "MyFormDemo"

Me.Top = 0
Me.Left = 0
Me.WindowState = 0
Picture_PlayerWnd.Left = Me.Left
Picture_PlayerWnd.Top = Me.Top

Picture_PlayerWnd.Width = Me.Width '这里设置宽度高度总不对!不知道要怎么换算???
Picture_PlayerWnd.Height = Me.Height
End If
bFull = Not bFull

End Sub

Private Sub Picture_PlayerWnd_DblClick()
MyFullScreen()
End Sub
...全文
141 5 打赏 收藏 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
孤独剑_LPZ 2009-07-14
  • 打赏
  • 举报
回复
将form的scaleMode=1 '像素模式
BlueLoves 2009-07-14
  • 打赏
  • 举报
回复
谢谢各位了,问题已解决。
设置窗体和控件 scaleMode为“像素模式” ,
并且取Width和Height的时候,有些地方需要除以15.
仔细调试,OK了。
clear_zero 2009-07-14
  • 打赏
  • 举报
回复
Me.WindowState = 0
这个不要
SYSSZ 2009-07-14
  • 打赏
  • 举报
回复
没啥不对,'Me.WindowState = 0 要去掉.
SYSSZ 2009-07-14
  • 打赏
  • 举报
回复
Dim bFull As Boolean
Private Sub MyFullScreen()
If (bFull) Then
' 如果是需要全屏,则
Me.BorderStyle = 0
Me.Caption = ""
'Me.WindowState = 0 '去掉
Me.Top = 0
Me.Left = 0
Me.Width = Screen.Width '这样设置宽度高度不对?
Me.Height = Screen.Height
Picture_PlayerWnd.Left = 0
Picture_PlayerWnd.Top = 0
Picture_PlayerWnd.Width = Me.Width '这样设置宽度高度总不对!不知道要怎么换算???
Picture_PlayerWnd.Height = Me.Height

Else
Me.BorderStyle = 2
Me.Caption = "MyFormDemo"

Me.Top = 0
Me.Left = 0
Me.WindowState = 0
Picture_PlayerWnd.Left = Me.Left
Picture_PlayerWnd.Top = Me.Top

Picture_PlayerWnd.Width = Me.Width '这里设置宽度高度总不对!不知道要怎么换算???
Picture_PlayerWnd.Height = Me.Height
End If
bFull = Not bFull

End Sub

Private Sub Picture_PlayerWnd_DblClick()
bFull = False
MyFullScreen
End Sub


1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧