1 怎么去掉mdi窗体的最大化按纽
2 在mdi窗体上加了一个"状态栏",在右下角出来一个能够改变[窗体大小的图标,怎样禁止掉
3 我的目的是除了最小化以外,不能改变mdi窗体的大小希望大家帮帮我!

解决方案 »

  1.   

    '关闭窗口的所有菜单功能
    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, i As Long
        hSysMenu = GetSystemMenu(Me.hwnd, False)
        If hSysMenu Then
            nCnt = GetMenuItemCount(hSysMenu)
            For i = nCnt To 0 Step -1
                RemoveMenu hSysMenu, i, MF_BYPOSITION Or MF_REMOVE  ' Remove the seperator
                DrawMenuBar Me.hwnd
                Me.Caption = "Try to close me!"
            Next
        End If
    End Sub
      

  2.   

    '灰掉"最大化"的按纽
    Option ExplicitPrivate Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
    Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    Private Const MF_BYPOSITION = &H400&
    Private ReadyToClose As BooleanPrivate Sub RemoveMenus(frm As Form, _
        remove_restore As Boolean, _
        remove_move As Boolean, _
        remove_size As Boolean, _
        remove_minimize As Boolean, _
        remove_maximize As Boolean, _
        remove_seperator As Boolean, _
        remove_close As Boolean)
        Dim hMenu As Long
        hMenu = GetSystemMenu(hwnd, False)
        If remove_close Then DeleteMenu hMenu, 6, MF_BYPOSITION
        If remove_seperator Then DeleteMenu hMenu, 5, MF_BYPOSITION
        If remove_maximize Then DeleteMenu hMenu, 4, MF_BYPOSITION
        If remove_minimize Then DeleteMenu hMenu, 3, MF_BYPOSITION
        If remove_size Then DeleteMenu hMenu, 2, MF_BYPOSITION
        If remove_move Then DeleteMenu hMenu, 1, MF_BYPOSITION
        If remove_restore Then DeleteMenu hMenu, 0, MF_BYPOSITION
    End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        Cancel = Not ReadyToClose
    End SubPrivate Sub MDIForm_Load()
        RemoveMenus Me, False, False, False, False, False, True, True
    End Sub
      

  3.   

    不是呀,就是本程序状态栏的右下角有三个"/"的那个小图标
    不是windows状态栏
      

  4.   

    to  fraser01(王晓栋) 和 alicky(周松) 
    谢谢你们了,你们的代码功能上都实现了,但是
    那怎么去掉或灰掉"最大化"的按纽和本程序"状态栏"右下角那个小图标呢?
      

  5.   

    #If Win32 Then
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    #Else
    Private Declare Function SetWindowLong Lib "User" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Long
    Private Declare Function GetWindowLong Lib "User" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Long
    #End IfConst WS_MINIMIZEBOX = &H20000 '最小化
    Const WS_MAXIMIZEBOX = &H10000 '最大化
    Const GWL_STYLE = (-16)'在 MDIForm 的 MDIForm_Load 事件中加入以下程序码Sub MDIForm_Load()
    Dim lWnd As Long
    lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
    lWnd = lWnd And Not (WS_MINIMIZEBOX) '最小化
    lWnd = lWnd And Not (WS_MAXIMIZEBOX) '最大化
    lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
    End Sub
      

  6.   

    不像其他的 Form 一样,MDIForm 并没有提供 MaxButton 及 MinButton 的属性来让我们移除最大化及最小化的按钮,如果您想移除 MDIForm 的最大化及最小化的按钮,您可以在 MDIForm 中加入以下的程序,但是如果您只想移除其中的一个,则只要将对应的程序码加上注解符号即可。'请在 MDIForm 的声明区中加入以下声明