Class ControlDrawing
Inheritance
System.Object
ControlDrawing
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()
Assembly: Syncfusion.Shared.Base.dll
public class ControlDrawing
Constructors
Declaration
Fields
DrawTextFlags
Inflate offset for drawing selection rectangle.
Declaration
public const int DrawTextFlags = 2404
Field Value
Properties
Declaration
public Point Offset { get; set; }
Property Value
| Type |
| System.Drawing.Point |
Methods
DrawAlignedText(Graphics, String, Font, Color, Rectangle, ContentAlignment)
Declaration
public void DrawAlignedText(Graphics g, string text, Font font, Color color, Rectangle rc, ContentAlignment align)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.String |
text |
|
| System.Drawing.Font |
font |
|
| System.Drawing.Color |
color |
|
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.ContentAlignment |
align |
|
Declaration
public void DrawBorder(Graphics g, Rectangle rc, BorderStyle borderStyle, Border3DStyle border3DStyle, ButtonBorderStyle borderSingle, Color borderColor)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Windows.Forms.BorderStyle |
borderStyle |
|
| System.Windows.Forms.Border3DStyle |
border3DStyle |
|
| System.Windows.Forms.ButtonBorderStyle |
borderSingle |
|
| System.Drawing.Color |
borderColor |
|
Declaration
public void DrawBorder(Graphics g, Rectangle rc, BorderStyle borderStyle, Border3DStyle border3DStyle, ButtonBorderStyle borderSingle, Color borderColor, Border3DSide sides)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Windows.Forms.BorderStyle |
borderStyle |
|
| System.Windows.Forms.Border3DStyle |
border3DStyle |
|
| System.Windows.Forms.ButtonBorderStyle |
borderSingle |
|
| System.Drawing.Color |
borderColor |
|
| System.Windows.Forms.Border3DSide |
sides |
|
Declaration
public void DrawFillColor(Graphics g, Rectangle rc, Color fillColor)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.Color |
fillColor |
|
Declaration
public void DrawGradient(Graphics g, Rectangle rc, Color color1, Color color2)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.Color |
color1 |
|
| System.Drawing.Color |
color2 |
|
Declaration
public void DrawImage(Graphics g, Rectangle rc, Image img, bool stretchImage)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.Image |
img |
|
| System.Boolean |
stretchImage |
|
Declaration
public void DrawMultipleGradient(Graphics g, Rectangle rc, ArrayList foreColors, bool vertical)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Collections.ArrayList |
foreColors |
|
| System.Boolean |
vertical |
|
Declaration
public void DrawTube(Graphics g, Rectangle rc, Color color1, Color color2)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.Color |
color1 |
|
| System.Drawing.Color |
color2 |
|
Declaration
public void DrawVerticalGradient(Graphics g, Rectangle rc, Color color1, Color color2)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
|
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.Color |
color1 |
|
| System.Drawing.Color |
color2 |
|
Declaration
public Brush GetGradientBrush(Rectangle rc, Color color1, Color color2)
Parameters
| Type |
Name |
Description |
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.Color |
color1 |
|
| System.Drawing.Color |
color2 |
|
Returns
| Type |
| System.Drawing.Brush |
Declaration
public Brush GetTubeBrush(Color color1, Color color2, Rectangle rc)
Parameters
| Type |
Name |
Description |
| System.Drawing.Color |
color1 |
|
| System.Drawing.Color |
color2 |
|
| System.Drawing.Rectangle |
rc |
|
Returns
| Type |
| System.Drawing.Brush |
Declaration
public Brush GetVerticalGradientBrush(Rectangle rc, Color color1, Color color2)
Parameters
| Type |
Name |
Description |
| System.Drawing.Rectangle |
rc |
|
| System.Drawing.Color |
color1 |
|
| System.Drawing.Color |
color2 |
|
Returns
| Type |
| System.Drawing.Brush |
Returns the width required to draw the text specified using the font specified.
Declaration
public static Size MeasureDisplayStringSize(Graphics graphics, string text, Font font, bool mirrored)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
graphics |
A System.Drawing.Graphics object.
|
| System.String |
text |
The text that is to be drawn.
|
| System.Drawing.Font |
font |
The System.Drawing.Font using which to draw.
|
| System.Boolean |
mirrored |
True - we use RTL, otherwise normal drawing.
|
Returns
| Type |
Description |
| System.Drawing.Size |
Width required.
|
Measure string with limit by width.
Declaration
public static Size MeasureDisplayStringSize(Graphics graphics, string text, Font font, bool mirrored, int width)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
graphics |
|
| System.String |
text |
|
| System.Drawing.Font |
font |
|
| System.Boolean |
mirrored |
|
| System.Int32 |
width |
-1 - apply single line mode for measuring, values greater zero
enables multiline measuring mode.
|
Returns
Methods recalculate point using Graphics matrix settings.
This method required when we will draw on Graphics created from HDC
that does not have applied transformations. Very useful when used
ControlPaint class for drawing.
Declaration
public static Point Transform(Graphics g, Point point)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
reference on Graphics
|
| System.Drawing.Point |
point |
Point to recalculate.
|
Returns
| Type |
Description |
| System.Drawing.Point |
Transformed point.
|
Methods recalculate top left and right bottom points
using Graphics matrix settings. This method required when we will
draw on Graphics created from HDC that does not have applied transformations.
Very useful when used ControlPaint class for drawing.
Declaration
public static Rectangle Transform(Graphics g, Rectangle rect)
Parameters
| Type |
Name |
Description |
| System.Drawing.Graphics |
g |
reference on Graphics
|
| System.Drawing.Rectangle |
rect |
rectangle to recalculate.
|
Returns
| Type |
Description |
| System.Drawing.Rectangle |
Transformed rectangle.
|
Rectangle rcBorders = ControlDrawing.Transform( g, this.Bounds );
ControlDrawing.DrawBorderInternal( g, rcBorders, this.BorderStyle, this.Border3DStyle, this.BorderSingle, this.BorderColor, this.BorderSides );