How do you disable the maximize button in VB6

Discussion in 'Code Snippets and Tutorials' started by Pankirk, May 27, 2007.

  1. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    Its that button in the middle of close and minimize. I know you can set "border style" to none or whatever and it will make everything go away except for the close button... But I want to make it so that you can still see all the buttons except the maximize button is disabled. Wow I make no sense, I hope someone can figure that out :)
     
  2. Billy

    Billy Level IV

    Joined:
    Feb 21, 2007
    Messages:
    1,856
    Likes Received:
    39
    the closest i can get to disabled is having a timer with this code in it running at one second
    Code (Text):
    1. If Me.WindowState = 2 Then
    2. Me.WindowState = 0
    3. End If
    and then have
    Code (Text):
    1. Private Sub Form_Load()
    2. Timer1.Enabled = True
    3. End Sub
    but all that does is have it bounce back every second and does not prevent the user from dragging the window larger, to do that, you would need to have it rechange the border every second
     
  3. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    That seems a bit harsh for the users using the program, because this is for my school and i'm getting paid for it so I'm kinda looking for something to disable the maximize button. I think ricky92 uses it on his programs. Thanks for the help anyway :)
     
  4. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    I just set the MaxButton Property to False. It will disable the button but it won't avoid the form to be sizable...
     
  5. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    I was hoping you could explain how to do it :)
     
  6. Smelly

    Smelly Level IV

    Joined:
    Dec 1, 2006
    Messages:
    2,197
    Likes Received:
    8
    Location:
    England
    set the form's "borderstyle" to "3 - fixed dialog"

    that stops resizing. but gets rid of the minimize button.
     
  7. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    I know smellyman....... But I want to keep the button there so I can minimize it.
     
  8. ricky92

    ricky92 Administrator
    Staff Member

    Joined:
    Nov 10, 2006
    Messages:
    1,866
    Likes Received:
    67
    You can set the WindowStyle to Fixed and then set the MinButton property to True. This will do the work ;)
     
  9. Pankirk

    Pankirk Level III

    Joined:
    Nov 12, 2006
    Messages:
    652
    Likes Received:
    28
    Location:
    America
    Ahh. Thats how you do it. Thankk you ricky :)