VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "TMPlayer"
   ClientHeight    =   3195
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.Menu File 
      Caption         =   "文件"
      Begin VB.Menu Open 
         Caption         =   "打开"
         Shortcut        =   ^O
      End
   End
   Begin VB.Menu View 
      Caption         =   "查看"
      Begin VB.Menu FullScreen 
         Caption         =   "全屏幕"
         Shortcut        =   {F11}
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub FullScreen_Click()
    form1.BorderStyle=
End SubPrivate Sub Open_Click()
    MsgBox "test"
End Sub
form1.BorderStyle设置为0,也没有效果,为什么呢?

解决方案 »

  1.   

    BorderStyle属性只能在设计状态有效。
      

  2.   

    同意 Surpass(网络飞狐) ( )
      

  3.   

    不同意,通过API可以动态更换的
      

  4.   

    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
    (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
    (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Const GWL_STYLE = (-16)
    Private Const WS_CAPTION = &HC00000     ' WS_BORDER 或 WS_DLGFRAME
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const WS_SYSMENU = &H80000Private Declare Function SetWindowPos Lib "user32" _
    (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
    ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As LongPrivate Enum ESetWindowPosStyles
        SWP_SHOWWINDOW = &H40
        SWP_HIDEWINDOW = &H80
        SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE
        SWP_NOACTIVATE = &H10
        SWP_NOCOPYBITS = &H100
        SWP_NOMOVE = &H2
        SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering
        SWP_NOREDRAW = &H8
        SWP_NOREPOSITION = SWP_NOOWNERZORDER
        SWP_NOSIZE = &H1
        SWP_NOZORDER = &H4
        SWP_DRAWFRAME = SWP_FRAMECHANGED
        HWND_NOTOPMOST = -2
    End EnumPrivate Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End TypePrivate Function ShowTitleBar(ByVal bState As Boolean)
    Dim lStyle As Long
    Dim tR As RECT    ' 获取窗口的位置:
        GetWindowRect Me.hwnd, tR    ' 调整标题栏是否可见:
        lStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
        If (bState) Then
        Me.Caption = Me.Tag
        If Me.ControlBox Then
            lStyle = lStyle Or WS_SYSMENU
        End If
        If Me.MaxButton Then
            lStyle = lStyle Or WS_MAXIMIZEBOX
        End If
        If Me.MinButton Then
            lStyle = lStyle Or WS_MINIMIZEBOX
        End If
        If Me.Caption <> "" Then
            lStyle = lStyle Or WS_CAPTION
        End If
        Else
        Me.Tag = Me.Caption
        Me.Caption = ""
        lStyle = lStyle And Not WS_SYSMENU
        lStyle = lStyle And Not WS_MAXIMIZEBOX
        lStyle = lStyle And Not WS_MINIMIZEBOX
        lStyle = lStyle And Not WS_CAPTION
    End If
    SetWindowLong Me.hwnd, GWL_STYLE, lStyle' 重新设定窗口:
    SetWindowPos Me.hwnd, 0, tR.Left, tR.Top, tR.Right - tR.Left, tR.Bottom - tR.Top, SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED
    Me.Refresh' 你可能需要在Form_Resize中加一点代码,因为客户区的大小已经改变:
    'Form_ResizeEnd Function
        '为了试验一下代码,在窗体上放一个CheckBox,将它的Value属性设为1 (Checked)。然后写入以下代码:Private Sub Check1_Click()
        If (Check1.Value = Checked) Then
        ShowTitleBar True
        Else
        ShowTitleBar False
    End If
    End Sub
      

  5.   

    Title Create a form without a title bar 
    Keywords form, title bar, caption, no title 
    Categories Controls, Tips and Tricks 
     
     
     
    Set these form properties: 
    Caption = "" 
    ControlBox = False 
    MinButton = False 
    MaxButton = False