菜鸟问题:窗体上控件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 SubPrivate Sub Picture_PlayerWnd_DblClick()
MyFullScreen()
End Sub

解决方案 »

  1.   

    将form的scaleMode=1  '像素模式
      

  2.   

    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 SubPrivate Sub Picture_PlayerWnd_DblClick()
    bFull = False
    MyFullScreen
    End Sub 
      

  3.   

    没啥不对,'Me.WindowState = 0 要去掉.
      

  4.   

     Me.WindowState = 0
    这个不要
      

  5.   

    谢谢各位了,问题已解决。
    设置窗体和控件 scaleMode为“像素模式” ,
    并且取Width和Height的时候,有些地方需要除以15.
    仔细调试,OK了。