LineShape Class
Represents a control displayed as a horizontal, vertical, or diagonal line.
System.MarshalByRefObject
System.ComponentModel.Component
Microsoft.VisualBasic.PowerPacks.Shape
Microsoft.VisualBasic.PowerPacks.LineShape
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
The LineShape type exposes the following members.
| Name | Description | |
|---|---|---|
|
LineShape() | Initializes a new instance of the LineShape class. |
|
LineShape(ShapeContainer) | Initializes a new instance of the LineShape class, specifying the ShapeContainer where it will be parented. |
|
LineShape(Int32, Int32, Int32, Int32) | Initializes a new instance of the LineShape class, specifying the coordinates for the line. |
| Name | Description | |
|---|---|---|
|
AccessibilityObject | Gets the AccessibleObject that is assigned to the control. (Inherited from Shape.) |
|
AccessibleDefaultActionDescription | Gets or sets the default action description of the control for use by accessibility client applications. (Inherited from Shape.) |
|
AccessibleDescription | Gets or sets the description of the control that is used by accessibility client applications. (Inherited from Shape.) |
|
AccessibleName | Gets or sets the name of the control that is used by accessibility client applications. (Inherited from Shape.) |
|
AccessibleRole | Gets or sets the accessible role of the control. (Inherited from Shape.) |
|
Anchor | Gets or sets the edges of the container to which a shape is bound, and determines how a shape is resized when its parent is resized. (Inherited from Shape.) |
|
BorderColor | Gets or sets the color of the border of a shape or line control. (Inherited from Shape.) |
|
BorderStyle | Gets or sets the border style for a shape or line control. (Inherited from Shape.) |
|
BorderWidth | Gets or sets the width of a line or shape control's border. (Inherited from Shape.) |
|
CanFocus | Gets a value indicating whether a line or shape control can receive focus. (Inherited from Shape.) |
|
CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component.) |
|
CanSelect | Gets a value indicating whether a line or shape control can be selected. (Inherited from Shape.) |
|
Container | Gets the IContainer that contains the Component. (Inherited from Shape.) |
|
ContainsFocus | Gets a value indicating whether a line or shape control currently has the input focus. (Inherited from Shape.) |
|
ContextMenu | Gets or sets the shortcut menu associated with a line or shape control. (Inherited from Shape.) |
|
ContextMenuStrip | Gets or sets the ContextMenuStrip associated with a line or shape control. (Inherited from Shape.) |
|
Created | Gets a value indicating whether a line or shape control has been created. (Inherited from Shape.) |
|
Cursor | Gets or sets the cursor that is displayed when the mouse pointer is resting on a line or shape control. (Inherited from Shape.) |
|
DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
|
Disposing | Gets a value indicating whether the base Shape class is disposing. (Inherited from Shape.) |
|
Enabled | Gets or sets a value indicating whether a line or shape control can respond to user interaction. (Inherited from Shape.) |
|
EndPoint | Gets or sets the ending coordinates of a line drawn by a LineShape control. |
|
Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
|
Focused | Gets a value indicating whether a line or shape control currently has the input focus. (Inherited from Shape.) |
|
IsAccessible | Gets or sets a value indicating whether a line or shape control is available to accessibility applications. (Inherited from Shape.) |
|
IsDisposed | Gets a value indicating whether a line or shape control has been disposed of. (Inherited from Shape.) |
|
Name | Gets or sets the name of a line or shape control. (Inherited from Shape.) |
|
Parent | Gets or sets the parent container of a line or shape control. (Inherited from Shape.) |
|
Region | Gets or sets the window region associated with a line or shape control. (Inherited from Shape.) |
|
SelectionColor | Gets or sets the selection color of a shape. (Inherited from Shape.) |
|
Site | Gets or sets the ISite of the Component. (Inherited from Component.) |
|
StartPoint | Gets or sets the starting coordinates of a line drawn by a LineShape control. |
|
Tag | Gets or sets the object that contains data about a line or shape control. (Inherited from Shape.) |
|
UseWaitCursor | Gets or sets a value indicating whether to use the wait cursor for the current line or shape control. (Inherited from Shape.) |
|
Visible | Gets or sets a value indicating whether a line or shape control is displayed. (Inherited from Shape.) |
|
X1 | Gets or sets the X coordinate of the starting point of a line drawn by a LineShape control. |
|
X2 | Gets or sets the X coordinate of the ending point of a line drawn by a LineShape control. |
|
Y1 | Gets or sets the Y coordinate of the starting point of a line drawn by a LineShape control. |
|
Y2 | Gets or sets the Y coordinate of the ending point of a line drawn by a LineShape control. |
| Name | Description | |
|---|---|---|
|
BringToFront | Brings a line or shape control to the front of the z-order. (Inherited from Shape.) |
|
CreateAccessibilityInstance | Creates an object to provide information that accessibility applications use to adjust an application's user interface (UI) for users who have disabilities. (Overrides Shape.CreateAccessibilityInstance().) |
|
CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
|
Dispose() | Releases all resources used by the Component. (Inherited from Component.) |
|
Dispose(Boolean) | Releases the unmanaged resources used by a line or shape control and optionally releases the managed resources. (Inherited from Shape.) |
|
DrawToBitmap | Supports drawing to the specified bitmap. (Overrides Shape.DrawToBitmap(Bitmap, Rectangle).) |
|
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
|
Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
|
FindForm | Retrieves the form that a line or shape control is on. (Inherited from Shape.) |
|
Focus | Sets input focus to a line or shape control. (Inherited from Shape.) |
|
GetContainerControl | Returns the next ContainerControl up in a line or shape control's chain of parent controls. (Inherited from Shape.) |
|
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
|
GetService | Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.) |
|
GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
Hide | Conceals a line or shape control from the user. (Inherited from Shape.) |
|
HitTest | Gets information about the LineShape control at the specified point on the screen. (Overrides Shape.HitTest(Int32, Int32).) |
|
InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
|
Invalidate | Invalidates a specific region of a line or shape control and causes a paint message to be sent to the control. (Inherited from Shape.) |
|
MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
|
OnClick | Raises the Click event. (Inherited from Shape.) |
|
OnContextMenuChanged | Raises the ContextMenuChanged event. (Inherited from Shape.) |
|
OnContextMenuStripChanged | Raises the ContextMenuStripChanged event. (Inherited from Shape.) |
|
OnCursorChanged | Raises the CursorChanged event. (Inherited from Shape.) |
|
OnDoubleClick | Raises the DoubleClick event. (Inherited from Shape.) |
|
OnEnabledChanged | Raises the EnabledChanged event. (Inherited from Shape.) |
|
OnEndPointChanged | Raises the EndPointChanged event. |
|
OnEnter | Raises the Enter event. (Inherited from Shape.) |
|
OnGotFocus | Raises the GotFocus event. (Inherited from Shape.) |
|
OnInvalidated | Raises the Invalidated event. (Inherited from Shape.) |
|
OnKeyDown | Raises the KeyDown event. (Inherited from Shape.) |
|
OnKeyPress | Raises the KeyPress event. (Inherited from Shape.) |
|
OnKeyUp | Raises the KeyUp event. (Inherited from Shape.) |
|
OnLeave | Raises the Leave event. (Inherited from Shape.) |
|
OnLostFocus | Raises the LostFocus event. (Inherited from Shape.) |
|
OnMouseClick | Raises the MouseClick event. (Inherited from Shape.) |
|
OnMouseDoubleClick | Raises the MouseDoubleClick event. (Inherited from Shape.) |
|
OnMouseDown | Raises the MouseDown event. (Inherited from Shape.) |
|
OnMouseEnter | Raises the MouseEnter event. (Inherited from Shape.) |
|
OnMouseHover | Raises the MouseHover event. (Inherited from Shape.) |
|
OnMouseLeave | Raises the MouseLeave event. (Inherited from Shape.) |
|
OnMouseMove | Raises the MouseMove event. (Inherited from Shape.) |
|
OnMouseUp | Raises the MouseUp event. (Inherited from Shape.) |
|
OnMouseWheel | Raises the MouseWheel event. (Inherited from Shape.) |
|
OnMove | Raises the Move event. (Inherited from Shape.) |
|
OnPaint | Raises the Paint event. (Overrides Shape.OnPaint(PaintEventArgs).) |
|
OnParentChanged | Raises the ParentChanged event. (Inherited from Shape.) |
|
OnPreviewKeyDown | Raises the PreviewKeyDown event. (Inherited from Shape.) |
|
OnQueryAccessibilityHelp | Raises the QueryAccessibilityHelp event. (Inherited from Shape.) |
|
OnRegionChanged | Raises the RegionChanged event. (Inherited from Shape.) |
|
OnStartPointChanged | Raises the StartPointChanged event. |
|
OnVisibleChanged | Raises the VisibleChanged event. (Inherited from Shape.) |
|
PointToClient | Computes the location of the specified screen point into client coordinates. (Inherited from Shape.) |
|
PointToScreen | Computes the location of the specified client point into screen coordinates. (Inherited from Shape.) |
|
RectangleToClient | Computes the size and location of the specified screen rectangle in client coordinates. (Inherited from Shape.) |
|
RectangleToScreen | Computes the size and location of the specified client rectangle in screen coordinates. (Inherited from Shape.) |
|
Refresh | Forces a control to invalidate its client area and immediately redraw itself and any child controls. (Inherited from Shape.) |
|
ResumePaint | Resumes usual painting logic, optionally forcing an immediate layout of pending paint requests. (Inherited from Shape.) |
|
Scale | Resizes the LineShape control by the specified scaling factor. (Overrides Shape.Scale(SizeF).) |
|
Select | Enables a control. (Inherited from Shape.) |
|
SendToBack | Sends a line or shape control to the back of the z-order. (Inherited from Shape.) |
|
Show | Displays a shape to the user. (Inherited from Shape.) |
|
SuspendPaint | Suspends the painting logic for a shape. (Inherited from Shape.) |
|
ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.) |
|
Update | Causes the control to redraw the invalidated regions within its client area. (Inherited from Shape.) |
| Name | Description | |
|---|---|---|
|
ChangeUICues | Occurs when the focus or keyboard user interface (UI) cues change. (Inherited from Shape.) |
|
Click | Occurs when the shape is clicked. (Inherited from Shape.) |
|
ContextMenuChanged | Occurs when the value of the ContextMenu property changes. (Inherited from Shape.) |
|
ContextMenuStripChanged | Occurs when the value of the ContextMenuStrip property changes. (Inherited from Shape.) |
|
CursorChanged | Occurs when the value of the Cursor property changes. (Inherited from Shape.) |
|
Disposed | Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.) |
|
DoubleClick | Occurs when the shape is double-clicked. (Inherited from Shape.) |
|
EnabledChanged | Occurs when the Enabled property value has changed. (Inherited from Shape.) |
|
EndPointChanged | Occurs when the EndPoint property value changes. |
|
Enter | Occurs when the shape is entered. (Inherited from Shape.) |
|
GotFocus | Occurs when the shape receives focus. (Inherited from Shape.) |
|
Invalidated | Occurs when a shape's display requires redrawing. (Inherited from Shape.) |
|
KeyDown | Occurs when a key is pressed and the shape has focus. (Inherited from Shape.) |
|
KeyPress | Occurs when a key is pressed and the shape has focus. (Inherited from Shape.) |
|
KeyUp | Occurs when a key is released and the shape has focus. (Inherited from Shape.) |
|
Leave | Occurs when the input focus leaves the shape. (Inherited from Shape.) |
|
LostFocus | Occurs when the shape loses focus. (Inherited from Shape.) |
|
MouseClick | Occurs when the shape is clicked by the mouse. (Inherited from Shape.) |
|
MouseDoubleClick | Occurs when the shape is double-clicked by the mouse. (Inherited from Shape.) |
|
MouseDown | Occurs when the mouse pointer is over the shape and a mouse button is pressed. (Inherited from Shape.) |
|
MouseEnter | Occurs when the mouse pointer enters the shape. (Inherited from Shape.) |
|
MouseHover | Occurs when the mouse pointer rests on the shape. (Inherited from Shape.) |
|
MouseLeave | Occurs when the mouse pointer leaves the shape. (Inherited from Shape.) |
|
MouseMove | Occurs when the mouse pointer is moved over the shape. (Inherited from Shape.) |
|
MouseUp | Occurs when the mouse pointer is over the shape and a mouse button is released. (Inherited from Shape.) |
|
MouseWheel | Occurs when the mouse wheel moves and the shape has focus. (Inherited from Shape.) |
|
Move | Occurs when the shape is moved. (Inherited from Shape.) |
|
Paint | Occurs when the shape is redrawn. (Inherited from Shape.) |
|
ParentChanged | Occurs when the Parent property value changes. (Inherited from Shape.) |
|
PreviewKeyDown | Occurs before the KeyDown event when a key is pressed and focus is on the shape. (Inherited from Shape.) |
|
QueryAccessibilityHelp | Occurs when an AccessibleObject is providing Help to accessibility applications. (Inherited from Shape.) |
|
RegionChanged | Occurs when the value of the Region property changes. (Inherited from Shape.) |
|
StartPointChanged | Occurs when the StartPoint property value changes. |
|
VisibleChanged | Occurs when the Visible property value changes. (Inherited from Shape.) |
The LineShape control enables you to draw lines on a form or container at design time or run time.
When you add a Line or Shape control to a form or container, an invisible ShapeContainer object is created. The ShapeContainer acts as a drawing surface for the shapes within each container control; each ShapeContainer has a corresponding ShapeCollection that enables you to iterate through the Line and Shape controls.
When you create a LineShape control at run time, you must also create a ShapeContainer and set the Parent property of the LineShape to the ShapeContainer.
The following example creates a ShapeContainer and a LineShape, adds them to a form, and displays a vertical line from the top to the bottom of the form.
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
Microsoft.VisualBasic.PowerPacks.LineShape line1 =
new Microsoft.VisualBasic.PowerPacks.LineShape();
// Set the form as the parent of the ShapeContainer.
canvas.Parent = this;
// Set the ShapeContainer as the parent of the LineShape.
line1.Parent = canvas;
// Set the starting and ending coordinates for the line.
line1.StartPoint = new System.Drawing.Point(this.Width / 2, 0);
line1.EndPoint = new System.Drawing.Point(this.Width / 2, this.Height);