CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    32

    keeping the size of the buttons the same

    hello guys

    I was wondering if i want to keep the size of the buttons the same when resizing the program, how can i code that.
    now when I resize the program the buttons become larger if I maximize the program the reverse is true, so how can I keep the buttons size the same?

    thanks

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: keeping the size of the buttons the same

    The display size of the buttons depends on the Layout manager you are using. Some layout managers increase the size of components as the screen area grows others don't. FlowLayout for instance sizes the buttons at their preferred size.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Nov 2011
    Location
    Vietnam
    Posts
    8

    Re: keeping the size of the buttons the same

    You can try button.setMaximumSize() and button.setMinimumSize(), set same size for both.

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: keeping the size of the buttons the same

    Quote Originally Posted by nambill
    You can try button.setMaximumSize() and button.setMinimumSize(), set same size for both.
    This won't work for all LayoutManagers as some only look at the preferred size and not the min/max sizes.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured