menu

WinForms

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

    Show / Hide Table of Contents

    Class GridUtil

    Implements the static helper functions.

    Inheritance
    System.Object
    GridUtil
    Inherited Members
    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.Grid
    Assembly: Syncfusion.Grid.Windows.dll
    Syntax
    public class GridUtil

    Fields

    AnyBottom

    Align at bottom on surface.

    Declaration
    public const ContentAlignment AnyBottom
    Field Value
    Type
    System.Drawing.ContentAlignment

    AnyCenter

    Align horizontally centered on surface.

    Declaration
    public const ContentAlignment AnyCenter
    Field Value
    Type
    System.Drawing.ContentAlignment

    AnyMiddle

    Align vertically centered on surface.

    Declaration
    public const ContentAlignment AnyMiddle
    Field Value
    Type
    System.Drawing.ContentAlignment

    AnyRight

    Align to right on surface.

    Declaration
    public const ContentAlignment AnyRight
    Field Value
    Type
    System.Drawing.ContentAlignment

    Methods

    AllSet(Int32, Int32)

    Internal only.

    Declaration
    public static bool AllSet(int value, int flags)
    Parameters
    Type Name Description
    System.Int32 value

    The value.

    System.Int32 flags

    The flags.

    Returns
    Type Description
    System.Boolean

    returns boolean value

    CenterInRect(Rectangle, Size)

    Returns a centered rectangle of a specified size within a given rectangle.

    Declaration
    public static Rectangle CenterInRect(Rectangle rect, Size size)
    Parameters
    Type Name Description
    System.Drawing.Rectangle rect

    The outer rectangle.

    System.Drawing.Size size

    The size of the rectangle to be centered.

    Returns
    Type Description
    System.Drawing.Rectangle

    The centered rectangle.

    CenterPoint(Rectangle)

    Returns a centered point within a given rectangle.

    Declaration
    public static Point CenterPoint(Rectangle rect)
    Parameters
    Type Name Description
    System.Drawing.Rectangle rect

    The outer rectangle.

    Returns
    Type Description
    System.Drawing.Point

    The centered point.

    ClearBits(ref Int32, Int32)

    Used internally.

    Declaration
    public static void ClearBits(ref int value, int flags)
    Parameters
    Type Name Description
    System.Int32 value
    System.Int32 flags

    ConvertToContentAlignment(GridHorizontalAlignment)

    Creates a System.Drawing.ContentAlignment from a GridHorizontalAlignment.

    Declaration
    public static ContentAlignment ConvertToContentAlignment(GridHorizontalAlignment align)
    Parameters
    Type Name Description
    GridHorizontalAlignment align

    The value to be converted.

    Returns
    Type Description
    System.Drawing.ContentAlignment

    The resulting System.Drawing.ContentAlignment.

    ConvertToContentAlignment(GridVerticalAlignment)

    Creates a System.Drawing.ContentAlignment from a GridVerticalAlignment.

    Declaration
    public static ContentAlignment ConvertToContentAlignment(GridVerticalAlignment align)
    Parameters
    Type Name Description
    GridVerticalAlignment align

    The value to be converted.

    Returns
    Type Description
    System.Drawing.ContentAlignment

    The resulting System.Drawing.ContentAlignment.

    ConvertToRotateStringAlignment(StringFormat, GridHorizontalAlignment, GridVerticalAlignment)

    Creates a System.Drawing.StringAlignment from a GridHorizontalAlignment and Creates a System.Drawing.StringAlignment from a GridVerticalAlignment.

    Declaration
    public static StringFormat ConvertToRotateStringAlignment(StringFormat strFormat, GridHorizontalAlignment hAlign, GridVerticalAlignment vAlign)
    Parameters
    Type Name Description
    System.Drawing.StringFormat strFormat

    StringFormat to return format

    GridHorizontalAlignment hAlign

    GridHorizontalAlignment

    GridVerticalAlignment vAlign

    GridVerticalAlignment

    Returns
    Type Description
    System.Drawing.StringFormat

    it returns StringFormat for rotation string

    ConvertToStringAlignment(GridHorizontalAlignment)

    Creates a System.Drawing.StringAlignment from a GridHorizontalAlignment.

    Declaration
    public static StringAlignment ConvertToStringAlignment(GridHorizontalAlignment align)
    Parameters
    Type Name Description
    GridHorizontalAlignment align

    The value to be converted.

    Returns
    Type Description
    System.Drawing.StringAlignment

    The resulting System.Drawing.StringAlignment.

    ConvertToStringAlignment(GridVerticalAlignment)

    Creates a System.Drawing.StringAlignment from a GridVerticalAlignment.

    Declaration
    public static StringAlignment ConvertToStringAlignment(GridVerticalAlignment align)
    Parameters
    Type Name Description
    GridVerticalAlignment align

    The value to be converted.

    Returns
    Type Description
    System.Drawing.StringAlignment

    The resulting System.Drawing.StringAlignment.

    Draw3dFrame(Graphics, Int32, Int32, Int32, Int32, Int32, Color, Color)

    Used internally. Draws the 3D frame.

    Declaration
    public static void Draw3dFrame(Graphics g, int x0, int y0, int x1, int y1, int w, Color rgbTopLeft, Color rgbBottomRight)
    Parameters
    Type Name Description
    System.Drawing.Graphics g
    System.Int32 x0
    System.Int32 y0
    System.Int32 x1
    System.Int32 y1
    System.Int32 w
    System.Drawing.Color rgbTopLeft
    System.Drawing.Color rgbBottomRight

    DrawDragRectHelper(Graphics, Rectangle, Rectangle)

    Used internally.

    Declaration
    public static void DrawDragRectHelper(Graphics g, Rectangle rect, Rectangle clip)
    Parameters
    Type Name Description
    System.Drawing.Graphics g
    System.Drawing.Rectangle rect
    System.Drawing.Rectangle clip

    GetParentControl(Control, Type)

    Gets the parent control of a specific type that the control is assigned to.

    Declaration
    public static Control GetParentControl(Control control, Type type)
    Parameters
    Type Name Description
    System.Windows.Forms.Control control

    The control whose parent form is searched.

    System.Type type

    The type of the parent control to search.

    Returns
    Type Description
    System.Windows.Forms.Control

    The parent control or NULL.

    GetParentFrame(Control)

    Gets the form that the control is assigned to.

    Declaration
    public static Form GetParentFrame(Control control)
    Parameters
    Type Name Description
    System.Windows.Forms.Control control

    The control whose parent form is searched.

    Returns
    Type Description
    System.Windows.Forms.Form

    The parent form of the control or NULL.

    Hiword(Int32)

    Returns the high word of an integer.

    Declaration
    public static int Hiword(int n)
    Parameters
    Type Name Description
    System.Int32 n

    The integer.

    Returns
    Type Description
    System.Int32

    The high word.

    IsActiveControl(Control)

    Returns a value indicating if the control is the active control in the parent container.

    Declaration
    public static bool IsActiveControl(Control control)
    Parameters
    Type Name Description
    System.Windows.Forms.Control control

    The control to be tested.

    Returns
    Type Description
    System.Boolean

    True if active; False otherwise.

    See Also
    System.Windows.Forms.IContainerControl

    IsEmpty(String)

    Checks if the string is NULL or length is 0.

    Declaration
    public static bool IsEmpty(string str)
    Parameters
    Type Name Description
    System.String str

    The string to be checked.

    Returns
    Type Description
    System.Boolean

    True if string is NULL or length is 0.

    IsNotSet(Int32, Int32)

    Used internally.

    Declaration
    public static bool IsNotSet(int value, int flags)
    Parameters
    Type Name Description
    System.Int32 value

    The value.

    System.Int32 flags

    The flags.

    Returns
    Type Description
    System.Boolean

    true if [is not set] [the specified value]; otherwise, false.

    IsNotValidNumber(Double)

    Checks if value is double.NaN.

    Declaration
    public static bool IsNotValidNumber(double b)
    Parameters
    Type Name Description
    System.Double b

    The value to compare.

    Returns
    Type Description
    System.Boolean

    True if this is is double.NaN.

    IsNotValidNumber(Single)

    Checks if value is float.NaN.

    Declaration
    public static bool IsNotValidNumber(float b)
    Parameters
    Type Name Description
    System.Single b

    The value to compare.

    Returns
    Type Description
    System.Boolean

    True if this is is double.NaN.

    IsSet(Int32, Int32)

    Used internally.

    Declaration
    public static bool IsSet(int value, int flags)
    Parameters
    Type Name Description
    System.Int32 value

    The value.

    System.Int32 flags

    The flags.

    Returns
    Type Description
    System.Boolean

    true if the specified value is set; otherwise, false.

    Loword(Int32)

    Returns the low word of an integer.

    Declaration
    public static int Loword(int n)
    Parameters
    Type Name Description
    System.Int32 n

    The integer.

    Returns
    Type Description
    System.Int32

    The low word.

    MakeLong(Int32, Int32)

    Creates a long from two integers.

    Declaration
    public static int MakeLong(int low, int high)
    Parameters
    Type Name Description
    System.Int32 low

    The low word.

    System.Int32 high

    The high word.

    Returns
    Type Description
    System.Int32

    The combined value.

    Max(Point, Point)

    Returns the point with larger value for X and Y coordinates each of two points.

    Declaration
    public static Point Max(Point point1, Point point2)
    Parameters
    Type Name Description
    System.Drawing.Point point1

    The first point to compare.

    System.Drawing.Point point2

    The second point to compare.

    Returns
    Type Description
    System.Drawing.Point

    The point with larger value for X and Y coordinates each of two points.

    Max(Size, Size)

    Returns the size with larger value for Width and Height coordinates for each of two values.

    Declaration
    public static Size Max(Size size1, Size size2)
    Parameters
    Type Name Description
    System.Drawing.Size size1

    The first size to compare.

    System.Drawing.Size size2

    The second size to compare.

    Returns
    Type Description
    System.Drawing.Size

    The size with larger value for Width and Height coordinates for each of two values.

    Min(Point, Point)

    Returns the point with smaller value for X and Y coordinates each of two points.

    Declaration
    public static Point Min(Point point1, Point point2)
    Parameters
    Type Name Description
    System.Drawing.Point point1

    The first point to compare.

    System.Drawing.Point point2

    The second point to compare.

    Returns
    Type Description
    System.Drawing.Point

    The point with smaller value for X and Y coordinates each of two points

    Min(Size, Size)

    Returns the size with smaller value for Width and Height coordinates for each of two values.

    Declaration
    public static Size Min(Size size1, Size size2)
    Parameters
    Type Name Description
    System.Drawing.Size size1

    The first size to compare.

    System.Drawing.Size size2

    The second size to compare.

    Returns
    Type Description
    System.Drawing.Size

    The size with smaller value for Width and Height coordinates for each of two values.

    MinMax(Double, Double, Double)

    Returns the value not smaller and not larger than a specified range.

    Declaration
    public static double MinMax(double value, double min, double max)
    Parameters
    Type Name Description
    System.Double value

    The value to compare.

    System.Double min

    The smallest value.

    System.Double max

    The largest value.

    Returns
    Type Description
    System.Double

    The value not smaller than min and and not larger than max.

    MinMax(Point, Point, Point)

    Returns the value not smaller and not larger than a specified range.

    Declaration
    public static Point MinMax(Point point, Point min, Point max)
    Parameters
    Type Name Description
    System.Drawing.Point point

    The value to compare.

    System.Drawing.Point min

    The smallest value.

    System.Drawing.Point max

    The largest value.

    Returns
    Type Description
    System.Drawing.Point

    The value not smaller than min and and not larger than max.

    Remarks

    The calculation is made for both the X and Y coordinates separately.

    MinMax(Point, Rectangle)

    Returns the value not smaller and not larger than a specified range.

    Declaration
    public static Point MinMax(Point point, Rectangle bounds)
    Parameters
    Type Name Description
    System.Drawing.Point point

    The value to compare.

    System.Drawing.Rectangle bounds

    The rectangle with bounds.

    Returns
    Type Description
    System.Drawing.Point

    The value not smaller than min and and not larger than max.

    Remarks

    The calculation is made for both the X and Y coordinates separately and compared with the rectangles boundaries.

    MinMax(Int32, Int32, Int32)

    Returns the value not smaller and not larger than a specified range.

    Declaration
    public static int MinMax(int value, int min, int max)
    Parameters
    Type Name Description
    System.Int32 value

    The value to compare.

    System.Int32 min

    The smallest value.

    System.Int32 max

    The largest value.

    Returns
    Type Description
    System.Int32

    The value not smaller than min and and not larger than max.

    MinMax(Single, Single, Single)

    Returns the value not smaller and not larger than a specified range.

    Declaration
    public static float MinMax(float value, float min, float max)
    Parameters
    Type Name Description
    System.Single value

    The value to compare.

    System.Single min

    The smallest value.

    System.Single max

    The largest value.

    Returns
    Type Description
    System.Single

    The value not smaller than min and and not larger than max.

    OffsetLeft(ref Rectangle, Int32)

    Increments the left coordinate of the rectangle only, the right coordinate remains the same.

    Declaration
    public static void OffsetLeft(ref Rectangle r, int dx)
    Parameters
    Type Name Description
    System.Drawing.Rectangle r

    The rectangle to be modified.

    System.Int32 dx

    The delta for changing the left bounds of the rectangle.

    OffsetLeft(ref RectangleF, Single)

    Increments the left coordinate of the rectangle only, the right coordinate remains the same.

    Declaration
    public static void OffsetLeft(ref RectangleF r, float dx)
    Parameters
    Type Name Description
    System.Drawing.RectangleF r

    The rectangle to be modified.

    System.Single dx

    The delta for changing the left bounds of the rectangle.

    OffsetLeftTop(ref Rectangle, Int32, Int32)

    Increments the top and left coordinate of the rectangle only, the bottom and right coordinates remain the same.

    Declaration
    public static void OffsetLeftTop(ref Rectangle r, int dx, int dy)
    Parameters
    Type Name Description
    System.Drawing.Rectangle r

    The rectangle to be modified.

    System.Int32 dx

    The delta for changing the left bounds of the rectangle.

    System.Int32 dy

    The delta for changing the top bounds of the rectangle.

    OffsetLeftTop(ref RectangleF, Single, Single)

    Increments the top and left coordinate of the rectangle only, the bottom and right coordinates remain the same.

    Declaration
    public static void OffsetLeftTop(ref RectangleF r, float dx, float dy)
    Parameters
    Type Name Description
    System.Drawing.RectangleF r

    The rectangle to be modified.

    System.Single dx

    The delta for changing the left bounds of the rectangle.

    System.Single dy

    The delta for changing the top bounds of the rectangle.

    OffsetTop(ref Rectangle, Int32)

    Increments the top coordinate of the rectangle only, the bottom coordinate remains the same.

    Declaration
    public static void OffsetTop(ref Rectangle r, int dy)
    Parameters
    Type Name Description
    System.Drawing.Rectangle r

    The rectangle to be modified.

    System.Int32 dy

    The delta for changing the top bounds of the rectangle.

    OffsetTop(ref RectangleF, Single)

    Increments the top coordinate of the rectangle only, the bottom coordinate remains the same.

    Declaration
    public static void OffsetTop(ref RectangleF r, float dy)
    Parameters
    Type Name Description
    System.Drawing.RectangleF r

    The rectangle to be modified.

    System.Single dy

    The delta for changing the top bounds of the rectangle.

    SetLeft(ref Rectangle, Int32)

    Changes the left coordinate of the rectangle only, the right coordinate remains the same.

    Declaration
    public static void SetLeft(ref Rectangle r, int x)
    Parameters
    Type Name Description
    System.Drawing.Rectangle r

    The rectangle to be modified.

    System.Int32 x

    The new value for the left bounds of the rectangle.

    SetLeft(ref RectangleF, Single)

    Changes the left coordinate of the rectangle only, the right coordinate remains the same.

    Declaration
    public static void SetLeft(ref RectangleF r, float x)
    Parameters
    Type Name Description
    System.Drawing.RectangleF r

    The rectangle to be modified.

    System.Single x

    The new value for the left bounds of the rectangle.

    SetRight(ref Rectangle, Int32)

    Changes the right coordinate of the rectangle only, the left coordinate remains the same.

    Declaration
    public static void SetRight(ref Rectangle r, int x)
    Parameters
    Type Name Description
    System.Drawing.Rectangle r

    The rectangle to be modified.

    System.Int32 x

    The new value for the right bounds of the rectangle.

    SetTop(ref Rectangle, Int32)

    Changes the top coordinate of the rectangle only, the bottom coordinate remains the same.

    Declaration
    public static void SetTop(ref Rectangle r, int y)
    Parameters
    Type Name Description
    System.Drawing.Rectangle r

    The rectangle to be modified.

    System.Int32 y

    The new value for the top bounds of the rectangle.

    SetTop(ref RectangleF, Single)

    Changes the top coordinate of the rectangle only, the bottom coordinate remains the same.

    Declaration
    public static void SetTop(ref RectangleF r, float y)
    Parameters
    Type Name Description
    System.Drawing.RectangleF r

    The rectangle to be modified.

    System.Single y

    The new value for the top bounds of the rectangle.

    SignedHIWORD(Int32)

    Used internally.

    Declaration
    public static int SignedHIWORD(int n)
    Parameters
    Type Name Description
    System.Int32 n
    Returns
    Type Description
    System.Int32

    returns Int SignedHIWORD

    SignedHIWORD(IntPtr)

    Internal only.

    Declaration
    public static int SignedHIWORD(IntPtr n)
    Parameters
    Type Name Description
    System.IntPtr n
    Returns
    Type Description
    System.Int32

    returns Int SignedHIWORD

    SignedLOWORD(Int32)

    Used internally.

    Declaration
    public static int SignedLOWORD(int n)
    Parameters
    Type Name Description
    System.Int32 n
    Returns
    Type Description
    System.Int32

    returns Int SignedLOWORD

    SignedLOWORD(IntPtr)

    Signeds the LOWORD.

    Declaration
    public static int SignedLOWORD(IntPtr n)
    Parameters
    Type Name Description
    System.IntPtr n
    Returns
    Type Description
    System.Int32

    Returns int SignedLOWOR

    SwapAlignment(StringAlignment)

    Swaps the System.Drawing.StringAlignment from Near to Far and vice versa.

    Declaration
    public static StringAlignment SwapAlignment(StringAlignment alignment)
    Parameters
    Type Name Description
    System.Drawing.StringAlignment alignment

    The value to be converted.

    Returns
    Type Description
    System.Drawing.StringAlignment

    The resulting System.Drawing.StringAlignment.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved