Position controls on Windows Forms in PPC

Source: Internet
Author: User

If you want to design a form that allows users to adjust its size at runtime, the controls on the form should be correctly adjusted and located. To dynamically adjust the widget size along with the form, you can use the anchor attribute of the Windows form control. The anchor attribute defines the position of the control's positioning point. When the control is anchored to a form, if the size of the form is adjusted, the control maintains the same distance between the control and the positioning position. For example, if a Textbox Control is positioned at the left, right, and bottom edges of the form, the Textbox Control is adjusted horizontally when the form size is adjusted, to maintain the distance from the right and left of the form. In addition, the control locates itself vertically so that its distance to the bottom side of the form remains unchanged. If the widget is not anchored and the size of the form is adjusted, the position of the widget relative to the edge of the form changes.

Pin controls on the form
Select the control to be anchored, and use the following method to simultaneously pin multiple controls: press Ctrl, click each control to select, and then follow the other steps in the process above.

1. In the Properties window, click the arrow to the right of the anchor attribute.

2. An editor is displayed, which displays a cross line.

3. To set the positioning point, click the upper, left, right, or lower part of the Cross line.

4. By default, the control is anchored to the left and top.

5. To clear the edges of the anchored control, click the corresponding arm of the cross line.

6. To disable the anchor Attribute Editor, click the anchor attribute name again.

When the form is displayed at run time, the control is adjusted to keep the distance from the edge of the form. The distance to the anchored edge is always the distance defined when the control is located in the Windows Forms designer.

Some controls (such as ComboBox controls) have a height limit. You cannot force a widget to exceed its height limit when it is anchored to the bottom of its form or container.

The inherited control can be anchored only when it is in the protected State. To change the access level of a control, set its modifiers attribute in the "properties" window.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.