Application width problem?

cwyong1

Active member
Joined
May 20, 2007
Messages
35
Programming Experience
Beginner
Hi there everyone.
Here is an explanation of what i am trying to do.
My application start with the main form ( MDI ) in full screen with coding to auto arranged 12 buttons ( the width of the button will be reset based on the formula of me.width - ( button1.width * 12 ) divided by 12

This work fine but the last button width overshoot the screen by a little bit.

Can somebody help me. PLEASE
 
Are we talking Windows.Forms or Windows.Controls? If it's Windows.Forms then I suggest that you use a TableLayoutPanel. Windows.Controls may have a similar control but I'm not sure.
 
Sorry for not making myself clearer.
Currently i am coding "me.width" to obtained the width of my master form and i am using it to deduct of the combined with of a default button width ( 12 all together ) afterwhich the balance is divided by 12 to the expand each of the button ( to lay them all horizontally ). All this work fine except that the final button width were cut of by a little bit. THE PROBLEM HERE IS THAT I BELIEVED I SHOULD BE USING SOME OTHER CLASS OTHER THAN "me.width". AM I RIGHT?
 
The Width of the form includes the border, so it's a bit bigger than the actual space available to controls. You should be using ClientSize.Width instead to get the internal width.
 
Back
Top