Hi!
please, help me about resizing controls(buttons,textboxes etc.) inside a windows form in VC#.
I created my application on 19“ monitor in form size: width=1292, height=1036. When i transfered mentioned application on laptop, which the largest form size are: width=1036 and height=780, i missing the most of controls.
Please, could anybody help me,how to resize my controls according to resized form, so that i can see all controls( entire contents of form) on the simplest way.
P.S. i try with Anchor and Dock but didn't help
Thank You very much.
Scott LyslePosted May 17, 2008, 2:46 AM
If you resize the controls at runtime based on screen resolution (I presume you want to make everything smaller to fit all of the controls if the resolution is less than you want it to be) then you run the risk of making the program less useful to people who run with a lower resolution because they want the controls to be larger due to the quality of their vision.
You can get the current resolution of a screen using the screen class and figure out the math to resize the controls given the difference between your ideal size and the user's display size (looping through the control collection to make the adjustments (but I would not recommend it):
Screen[] arr = Screen.AllScreens;
for (int i = 0; i < arr.Length; i++)
{
MessageBox.Show(arr[i].BitsPerPixel.ToString(), "Bits Per Pixel");
MessageBox.Show(arr[i].WorkingArea.Height.ToString(), "Height");
MessageBox.Show(arr[i].WorkingArea.Width.ToString(), "Width");
}