System.Design
2.0.0.0
System.Object
The following table lists the common modes that visual design tools support to assist you with positioning and sizing controls on a design surface.
-
Mode
Description
-
Freeform
Enables you to freely lay out controls.
-
Grid
Displays a static overlaid grid that assists you in laying out controls.
-
Snapline
Displays guide lines that assist you in laying out the container's controls relative to each other. Snaplines originate from controls and their container.
The class and related types help support the Snapline mode.
Snaplines are generated dynamically and automatically as a control edge moves near another control or near the boundaries of its container. This can occur when a control is added from the toolbox, or moved or resized by mouse operations or keyboard commands. Controls typically have both horizontal and vertical snaplines defined; for rectangular controls, these typically extend from all four edges.
The class uses only a few properties to describe each snapline, as shown in the following table.
-
Property
Description
-
Specifies the location and direction of the line with respect to its associated control. Typically, only snaplines of similar types will auto-align to each other.
-
Specifies the distance in pixels from the origin, which is the upper-left corner of the control, to where the snapline starts.
-
Specifies the relative importance of the snapline. During any given layout decision point, only the snaplines that are active and have the highest priority are displayed.
-
Defines custom categories of snaplines. This is an optional string.
-
and
Indicates whether a snapline has horizontal or vertical orientation, respectively.
The class stores snaplines for its corresponding control type in the property. This base class handling of snaplines will suffice for the majority of controls, as it defines the , , , and snaplines, which are aligned along the edges of the control. When you are developing a custom control, if this default organization does not suffice, override the property of the class derived from . For example, you may want to align the horizontal snaplines of text-based controls, such as labels, with the top and base lines of the text (instead of the top and bottom edges of the control).
The class cannot be derived from.
There is extensive support for this feature in Visual Studio.
dl_WalkthroughArrangingControlsWindowsFormsUsingSnaplines
Represents the horizontal and vertical line segments that are dynamically created in the user interface (UI) to assist in the design-time layout of controls in a container. This class cannot be inherited.
Constructor
2.0.0.0
This constructor sets the property to null and the property to .
Initializes a new instance of the class using the specified snapline type and offset.
The to create. Describes the relative position and orientation of the snapline.
The position of the snapline, in pixels, relative to the upper-left origin of the owning control.
Constructor
2.0.0.0
This constructor sets the property to .
Initializes a new instance of the class using the specified snapline type, offset, and filter name.
The to create. Describes the relative position and orientation of the snapline.
The position of the snapline, in pixels, relative to the upper-left origin of the owning control.
A used to specify a programmer-defined category of snaplines.
Constructor
2.0.0.0
This constructor sets the property to null.
Initializes a new instance of the class using the specified snapline type, offset, and priority.
The to create. Describes the relative position and orientation of the snapline.
The position of the snapline, in pixels, relative to the upper-left origin of the owning control.
The of the snapline.
Constructor
2.0.0.0
This constructor sets all of the properties of a snapline to programmer-supplied values.
Initializes a new instance of the class using the specified snapline type, offset, filter name, and priority.
The to create. Describes the relative position and orientation of the snapline.
The position of the snapline, in pixels, relative to the upper-left origin of the owning control.
A used to specify a programmer-defined category of snaplines.
The of the snapline.
Method
2.0.0.0
System.Void
The offset of a snapline is the distance, in pixels, that the snapline is located from the associated control's upper-left origin. Although the offset can be set to any integer value, typically the snaplines retain the spatial relationships implied by their property value.
Adjusts the property of the snapline.
The number of pixels to change the snapline offset by.
Property
2.0.0.0
System.String
To be added.
The property is used to define custom categories of snaplines. Only snaplines with the same filter name are able to snap to each other. This property can be used in custom control designers to expose different categories of snaplines depending upon the state of the control or the type of operation being performed. For example, round controls could offer a custom snapline with the filter value of "Center".
This property is initialized during construction and cannot be changed thereafter.
Gets the programmer-defined filter category associated with this snapline.
Property
2.0.0.0
System.Boolean
To be added.
The following snapline types are horizontal: , , , and .
Gets a value indicating whether the snapline has a horizontal orientation.
Property
2.0.0.0
System.Boolean
To be added.
The following snapline types are vertical: , , and .
Gets a value indicating whether the snapline has a vertical orientation.
Property
2.0.0.0
System.Int32
To be added.
The origin of a control is the upper-left point of the control. A single offset can describe the position of a snapline, because vertical snaplines may have only a nonzero x-axis offset, whereas horizontal snaplines may only have a nonzero y-axis offset.
The property is initialized at construction time, but it can be changed thereafter with the method.
Gets the number of pixels that the snapline is offset from the origin of the associated control.
Property
2.0.0.0
System.Windows.Forms.Design.Behavior.SnapLinePriority
To be added.
The property establishes categories of importance for the snaplines associated with a control.
The Windows Forms Designer uses this property to determine which snaplines to display during a control addition, resize, or move operation. For more information, see the enumeration.
This property is initialized during construction and cannot be changed thereafter.
Gets a value indicating the relative importance of the snapline.
Method
2.0.0.0
System.Boolean
To be added.
Returns a value indicating whether the specified should snap to another .
true if should snap to ; otherwise, false.
The specified .
The to which the specified is expected to snap.
Property
2.0.0.0
System.Windows.Forms.Design.Behavior.SnapLineType
To be added.
Visual designers use the property to direct snap alignment operations. Typically only snaplines that are similarly oriented can snap to each other. For example, two snaplines of type can snap together, but a and a snapline cannot.
This property is initialized during construction and cannot be changed thereafter.
Gets the type of a snapline, which indicates the general location and orientation.
Method
2.0.0.0
System.String
This method returns a string that contains details about the type, offset, priority, and filter values of the snapline.
Returns a string representation of the current snapline.
A that represents the current .