form1.maxbutton = False
form1.minButton = True

解决方案 »

  1.   

    要使最大化按扭失效,上面的代码在运行时会出现错误,因为 maxbutton 是只读属性,应该调用api函数来实现,原理是使窗口菜单的最大化命令失效。
      

  2.   

    在属性窗口中选FORM,设置
    maxbutton = False
    minButton = True
    ShowinTaskbar=False
      

  3.   

    用RemoveMenu(),API函数...Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
    Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
    Const MF_BYPOSITION = &H400&
    Const MF_REMOVE = &H1000&
    Private Sub Form_Load()
        Dim hSysMenu As Long, nCnt As Long
        ' Get handle to our form's system menu
        ' (Restore, Maximize, Move, close etc.)
        hSysMenu = GetSystemMenu(Me.hwnd, False)    If hSysMenu Then
            ' Get System menu's menu count
            nCnt = GetMenuItemCount(hSysMenu)
            If nCnt Then
                ' Menu count is based on 0 (0, 1, 2, 3...)
                RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION Or MF_REMOVE
                DrawMenuBar Me.hwnd
                ' Force caption bar's refresh. 
                Me.Caption = "Try to close me!"
            End If
        End If
    End Sub此方法只能禁止窗口“罪”大化,但不能变灰色,其实最好的方法是在设计的时候把MaxButton属性设为False。