menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class LayoutGrid - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class LayoutGrid

    Base class for objects that draw a grid onto a view.

    Inheritance
    System.Object
    PropertyContainer
    LayoutGrid
    Implements
    IServiceReferenceHolder
    IServiceReferenceProvider
    IPropertyObserver
    IPropertyContainer
    System.ICloneable
    System.Runtime.Serialization.ISerializable
    System.IDisposable
    Inherited Members
    PropertyContainer.Dispose()
    PropertyContainer.FullContainerName
    PropertyContainer.GetPropertyContainerByName(String)
    PropertyContainer.HistoryService
    PropertyContainer.InheritContainerMeasureUnits
    PropertyContainer.IPropertyObserver.OnPropertyChanged(String, String)
    PropertyContainer.IPropertyObserver.OnPropertyChanging(String, String, Object)
    PropertyContainer.ISerializable.GetObjectData(SerializationInfo, StreamingContext)
    PropertyContainer.m_propertyObserver
    PropertyContainer.OnPropertyChanged(String)
    PropertyContainer.OnPropertyChanging(String, Object)
    PropertyContainer.PropertyObserber
    PropertyContainer.ProvideServiceReference(RuntimeTypeHandle)
    PropertyContainer.RecordPropertyChanged(String)
    PropertyContainer.UpdateServiceReferences(IServiceReferenceProvider)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms.Diagram
    Assembly: Syncfusion.Diagram.Base.dll
    Syntax
    public class LayoutGrid : PropertyContainer, IServiceReferenceHolder, IServiceReferenceProvider, IPropertyObserver, IPropertyContainer, ICloneable, ISerializable, IDisposable
    Remarks

    Derived classes must override the Draw(Graphics, RectangleF) method in order to draw the grid.

    View

    Constructors

    LayoutGrid(LayoutGrid)

    Initializes a new instance of the LayoutGrid class.

    Declaration
    public LayoutGrid(LayoutGrid src)
    Parameters
    Type Name Description
    LayoutGrid src

    The SRC.

    LayoutGrid(View)

    Initializes a new instance of the LayoutGrid class.

    Declaration
    public LayoutGrid(View containerView)
    Parameters
    Type Name Description
    View containerView

    View in which to draw the grid.

    LayoutGrid(SerializationInfo, StreamingContext)

    Initializes a new instance of the LayoutGrid class. Deserialization constructor.

    Declaration
    protected LayoutGrid(SerializationInfo info, StreamingContext context)
    Parameters
    Type Name Description
    System.Runtime.Serialization.SerializationInfo info

    The info.

    System.Runtime.Serialization.StreamingContext context

    The context.

    Properties

    Color

    Gets or sets the color to use for drawing the grid.

    Declaration
    public Color Color { get; set; }
    Property Value
    Type
    System.Drawing.Color

    ContainerView

    Gets or sets the view this grid is attached to.

    Declaration
    public View ContainerView { get; set; }
    Property Value
    Type
    View
    Remarks

    This property is a reference to the view that the layout grid renders itself onto.

    View

    DashOffset

    Gets or sets distance from the start of the line to the dash pattern.

    Declaration
    public float DashOffset { get; set; }
    Property Value
    Type
    System.Single

    DashStyle

    Gets or sets a System.Drawing.Drawing2D.DashStyle value to use for dashed lines.

    Declaration
    public DashStyle DashStyle { get; set; }
    Property Value
    Type
    System.Drawing.Drawing2D.DashStyle

    GridStyle

    Gets or sets the appearance of the grid.

    Declaration
    public GridStyle GridStyle { get; set; }
    Property Value
    Type
    GridStyle

    HorizontalSpacing

    Gets or sets the horizontal distance between grid points.

    Declaration
    public float HorizontalSpacing { get; set; }
    Property Value
    Type
    System.Single
    Remarks

    Spacing is specified in world units.

    MeasureUnit

    Gets or sets the measure unit.

    Declaration
    public override MeasureUnits MeasureUnit { get; set; }
    Property Value
    Type Description
    MeasureUnits

    The measure unit.

    Overrides
    PropertyContainer.MeasureUnit

    MinPixelSpacing

    Gets or sets minimum spacing between grid points in device units.

    Declaration
    public float MinPixelSpacing { get; set; }
    Property Value
    Type
    System.Single
    Remarks

    This value specifies the threshold at which the grid will stop drawing itself because the spacing between grid points is too small.

    RenderingStyle

    Gets the grid rendering style.

    Declaration
    public RenderingStyle RenderingStyle { get; }
    Property Value
    Type Description
    RenderingStyle

    The rendering style.

    Remarks

    The rendering style is used to configure graphics.

    SnapToGrid

    Gets or sets a value indicating whether the snap to grid feature is enable or disabled.

    Declaration
    public bool SnapToGrid { get; set; }
    Property Value
    Type
    System.Boolean
    Remarks

    This property determines how the GetNearestGridPoint(PointF) method behaves.

    GetNearestGridPoint(PointF, Int32)

    VerticalSpacing

    Gets or sets the vertical distance between grid points.

    Declaration
    public float VerticalSpacing { get; set; }
    Property Value
    Type
    System.Single
    Remarks

    Spacing is specified in world units.

    Visible

    Gets or sets a value indicating whether controls in the grid is visible.

    Declaration
    public bool Visible { get; set; }
    Property Value
    Type
    System.Boolean

    Methods

    Clone()

    Clones this instance.

    Declaration
    public override object Clone()
    Returns
    Type Description
    System.Object

    The cloned object.

    Overrides
    PropertyContainer.Clone()

    Draw(Graphics, RectangleF)

    Renders the grid onto a specified System.Drawing.Graphics object.

    Declaration
    public virtual void Draw(Graphics grfx, RectangleF rectGrid)
    Parameters
    Type Name Description
    System.Drawing.Graphics grfx

    Drawing context object.

    System.Drawing.RectangleF rectGrid

    Visible grid bounds.

    Remarks

    This method is overridden in derived classes to render specific types of grids.

    DrawHorizontalLines(Graphics, Pen, RectangleF)

    Draws the horizontal lines inside rectangle.

    Declaration
    protected void DrawHorizontalLines(Graphics gfx, Pen penLine, RectangleF rectClip)
    Parameters
    Type Name Description
    System.Drawing.Graphics gfx

    Graphics to draw on.

    System.Drawing.Pen penLine

    The pen line.

    System.Drawing.RectangleF rectClip

    The graphics clip rectangle.

    DrawLineGrid(Graphics, RectangleF)

    Renders the grid onto a specified System.Drawing.Graphics object as lines.

    Declaration
    protected virtual void DrawLineGrid(Graphics grfx, RectangleF rectGridBounds)
    Parameters
    Type Name Description
    System.Drawing.Graphics grfx

    Drawing context object.

    System.Drawing.RectangleF rectGridBounds

    The grid bounds.

    DrawPointGrid(Graphics, RectangleF)

    Renders the grid onto a specified System.Drawing.Graphics object.

    Declaration
    public virtual void DrawPointGrid(Graphics grfx, RectangleF rectGridBounds)
    Parameters
    Type Name Description
    System.Drawing.Graphics grfx

    Drawing context object.

    System.Drawing.RectangleF rectGridBounds

    Visible grid bounds.

    Remarks

    Sets pixel values directly on the view's drawing surface.

    DrawPoints(Graphics, RectangleF)

    Draws the points inside rectangle.

    Declaration
    protected void DrawPoints(Graphics gfx, RectangleF rectClip)
    Parameters
    Type Name Description
    System.Drawing.Graphics gfx

    Graphics to draw on.

    System.Drawing.RectangleF rectClip

    The clip rectangle.

    DrawVerticalLines(Graphics, Pen, RectangleF)

    Draws the vertical lines inside rectangle.

    Declaration
    protected void DrawVerticalLines(Graphics gfx, Pen penLine, RectangleF rectClip)
    Parameters
    Type Name Description
    System.Drawing.Graphics gfx

    Graphics to draw on.

    System.Drawing.Pen penLine

    The pen line.

    System.Drawing.RectangleF rectClip

    The graphics clip rectangle.

    GetNearestGridPoint(PointF)

    Takes a device point and returns the point on the grid that is nearest to that point.

    Declaration
    public PointF GetNearestGridPoint(PointF ptScene)
    Parameters
    Type Name Description
    System.Drawing.PointF ptScene

    Input point.

    Returns
    Type Description
    System.Drawing.PointF

    Point on the grid in client coordinates.

    Remarks

    Points are in device coordinates. This method is used to when the snap to grid feature is enabled.

    SnapToGrid

    GetNearestGridPoint(PointF, Boolean)

    Declaration
    public PointF GetNearestGridPoint(PointF ptScene, bool excludeOrigin)
    Parameters
    Type Name Description
    System.Drawing.PointF ptScene
    System.Boolean excludeOrigin
    Returns
    Type
    System.Drawing.PointF

    GetNearestGridPoint(PointF, Int32)

    Declaration
    public PointF GetNearestGridPoint(PointF ptScene, int rulerHeight)
    Parameters
    Type Name Description
    System.Drawing.PointF ptScene
    System.Int32 rulerHeight
    Returns
    Type
    System.Drawing.PointF

    GetNearestGridPoint(PointF, Int32, Boolean)

    Declaration
    public PointF GetNearestGridPoint(PointF ptScene, int rulerHeight, bool excludeOrigin)
    Parameters
    Type Name Description
    System.Drawing.PointF ptScene
    System.Int32 rulerHeight
    System.Boolean excludeOrigin
    Returns
    Type
    System.Drawing.PointF

    GetObjectData(SerializationInfo, StreamingContext)

    Gets the object data.

    Declaration
    protected override void GetObjectData(SerializationInfo info, StreamingContext context)
    Parameters
    Type Name Description
    System.Runtime.Serialization.SerializationInfo info

    The info.

    System.Runtime.Serialization.StreamingContext context

    The context.

    Overrides
    PropertyContainer.GetObjectData(SerializationInfo, StreamingContext)

    GetPropertyContainerName()

    Gets the name of the property container.

    Declaration
    protected override string GetPropertyContainerName()
    Returns
    Type Description
    System.String

    The property container name.

    Overrides
    PropertyContainer.GetPropertyContainerName()

    OnMeasureUnitsChanging(MeasureUnits, MeasureUnits)

    Called when measure units changing.

    Declaration
    protected override void OnMeasureUnitsChanging(MeasureUnits from, MeasureUnits to)
    Parameters
    Type Name Description
    MeasureUnits from

    Old value of the measure units .

    MeasureUnits to

    New value of the measure units.

    Overrides
    PropertyContainer.OnMeasureUnitsChanging(MeasureUnits, MeasureUnits)

    ResetColor()

    Resets the color.

    Declaration
    protected void ResetColor()

    ShouldSerializeColor()

    Serialize the color.

    Declaration
    protected bool ShouldSerializeColor()
    Returns
    Type Description
    System.Boolean

    true, if serialize the color.

    Implements

    IServiceReferenceHolder
    IServiceReferenceProvider
    IPropertyObserver
    IPropertyContainer
    System.ICloneable
    System.Runtime.Serialization.ISerializable
    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved