I have a WinForms application , I want to run it any in resolution and I also don't want to alter position and space b/w different controls. enter image description here

This is snap shot in first case but after changing the resolution it seems like this I want according to the resolution, it's control automatically resize their size to maintain space between them. enter image description here

有帮助吗?

解决方案

You can use the Anchor or Dock property of controls.
If you don't want to alter relative positioning between controls.
According to msdn:-

Use the Anchor property to define how a control is automatically resized as its parent control is resized. Anchoring a control to its parent control ensures that the anchored edges remain in the same position relative to the edges of the parent control when the parent control is resize

and

Use the Dock property to define how a control is automatically resized as its parent control is resized. For example, setting Dock to DockStyle.Left causes the control to align itself with the left edges of its parent control and to resize as the parent control is resized. Controls are docked in their Z-order, which is the visual layering of controls on a form along the form's Z-axis (depth). A control can be docked to one edge of its parent container or can be docked to all edges and fill the parent container.

and to make you Form resolution friendly, why don't you try this:-

    this.WindowState = WindowState.Maximized

其他提示

Go to Properties tab of every control select anchor and select those grey bars to which sides you want the control to resize:

enter image description here

Now when you resize the form you will see that your controls resizes automatically with that.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top