Class GridFontInfo
Implements a StyleInfoSubObjectBase object for font settings in a cell. Each font property of the cell can be configured individually.
Font properties that have not been initialized will inherit default values from a base style.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridFontInfo : GridStyleInfoSubObject, ICustomTypeDescriptor, IDisposable, IStyleInfo, ISupportInitialize, IFormattable, IConvertible, IXmlSerializable, IStyleInfoSubObject
Examples
The following code changes font information for cells:
model[rowIndex, colIndex].Font.Facename = "Arial";
model[rowIndex, colIndex].Font.Bold = true;
Constructors
GridFontInfo()
Initializes a new instance of GridFontInfo class.
Declaration
public GridFontInfo()
GridFontInfo(StyleInfoSubObjectIdentity)
Initalizes a new instance ofGridFontInfo object and associates it with an existing GridStyleInfoSubObjectIdentity.
Declaration
public GridFontInfo(StyleInfoSubObjectIdentity identity)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoSubObjectIdentity | identity | A GridStyleInfoSubObjectIdentity that holds the identity for this GridFontInfo. |
GridFontInfo(StyleInfoSubObjectIdentity, GridFontInfoStore)
Initalizes a new instance ofGridFontInfo object and associates it with an existing GridStyleInfoSubObjectIdentity.
Declaration
public GridFontInfo(StyleInfoSubObjectIdentity identity, GridFontInfoStore store)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoSubObjectIdentity | identity | A GridStyleInfoSubObjectIdentity that holds the identity for this GridFontInfo |
GridFontInfoStore | store | A GridFontInfoStore that holds data for this GridFontInfo. All changes in this style object will saved in the GridFontInfoStore object. |
GridFontInfo(Font)
Initializes a new instance ofGridFontInfo object and initializes its FaceName, FontStyle, Size and Unit from the specified font object.
Declaration
public GridFontInfo(Font font)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Font | font | A System.Drawing.Font with font information. |
Examples
This example shows how to use the GridFontInfo(Font) method.
Font font = new Font("Segoe UI", 9.5f);
this.gridControl1.TableStyle.Font = new GridFontInfo(font);
Dim font As New Font("Segoe UI", 9.5f)
Me.gridControl1.TableStyle.Font = New GridFontInfo(font)
Properties
Bold
Gets or sets a value indicating whether this GridFontInfo object is bold.
Declaration
public bool Bold { get; set; }
Property Value
Type |
---|
System.Boolean |
Default
Gets a default GridFontInfo to be used with a default style.
Declaration
public static GridFontInfo Default { get; }
Property Value
Type |
---|
GridFontInfo |
Remarks
The Default of the GridStyleInfo class will return the default border info that this method generates through its overridden version of GetDefaultStyle().
Facename
Gets or sets the face name of this GridFontInfo object.
Declaration
public string Facename { get; set; }
Property Value
Type |
---|
System.String |
FontStyle
Gets or sets style information for the font.
Declaration
public FontStyle FontStyle { get; set; }
Property Value
Type |
---|
System.Drawing.FontStyle |
GdipFont
Gets or creates a cached GDI+ Font generated from font information of this GridFontInfo object.
Declaration
public Font GdipFont { get; }
Property Value
Type |
---|
System.Drawing.Font |
HasBold
Gets a value indicating whether the Bold property has been initialized.
Declaration
public bool HasBold { get; }
Property Value
Type |
---|
System.Boolean |
HasFacename
Gets a value indicating whether the Facename property has been initialized.
Declaration
public bool HasFacename { get; }
Property Value
Type |
---|
System.Boolean |
HasItalic
Gets a value indicating whether the Italic property has been initialized.
Declaration
public bool HasItalic { get; }
Property Value
Type |
---|
System.Boolean |
HasOrientation
Gets a value indicating whether the Orientation property has been initialized.
Declaration
public bool HasOrientation { get; }
Property Value
Type |
---|
System.Boolean |
HasSize
Gets a value indicating whether the Size property has been initialized.
Declaration
public bool HasSize { get; }
Property Value
Type |
---|
System.Boolean |
HasStrikeout
Gets a value indicating whether the Strikeout property has been initialized.
Declaration
public bool HasStrikeout { get; }
Property Value
Type |
---|
System.Boolean |
HasUnderline
Gets a value indicating whether the Underline property has been initialized.
Declaration
public bool HasUnderline { get; }
Property Value
Type |
---|
System.Boolean |
HasUnit
Gets a value indicating whether the Unit property has been initialized.
Declaration
public bool HasUnit { get; }
Property Value
Type |
---|
System.Boolean |
Italic
Gets or sets a value indicating whether this GridFontInfo object is italic.
Declaration
public bool Italic { get; set; }
Property Value
Type |
---|
System.Boolean |
Orientation
Gets or sets the orientation of this GridFontInfo object.
Declaration
public int Orientation { get; set; }
Property Value
Type |
---|
System.Int32 |
Size
Gets or sets the size in pixels of this GridFontInfo object.
Declaration
public float Size { get; set; }
Property Value
Type |
---|
System.Single |
Strikeout
Gets or sets a value indicating whether this GridFontInfo object should draw a horizontal line through the text.
Declaration
public bool Strikeout { get; set; }
Property Value
Type |
---|
System.Boolean |
Underline
Gets or sets a value indicating whether this GridFontInfo object is underlined.
Declaration
public bool Underline { get; set; }
Property Value
Type |
---|
System.Boolean |
Unit
Gets or sets the graphics unit of this GridFontInfo object.
Declaration
public GraphicsUnit Unit { get; set; }
Property Value
Type |
---|
System.Drawing.GraphicsUnit |
Methods
Dispose(Boolean)
Releases the all resources used by the Component.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
GetDefaultStyle()
Override this method to return a default style object for your derived class.
Declaration
protected override StyleInfoBase GetDefaultStyle()
Returns
Type | Description |
---|---|
StyleInfoBase | A default style object. |
Overrides
MakeCopy(StyleInfoBase, StyleInfoProperty)
Creates an exact copy of the current object.
Declaration
public override IStyleInfoSubObject MakeCopy(StyleInfoBase newOwner, StyleInfoProperty sip)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoBase | newOwner | The new owner style object for the copied object. |
StyleInfoProperty | sip | Identifier for this object. |
Returns
Type | Description |
---|---|
IStyleInfoSubObject | Copy of the current object. |
Overrides
OnStyleChanged(StyleInfoProperty)
Invoked when Font style is changed and reset the font.
Declaration
protected override void OnStyleChanged(StyleInfoProperty sip)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoProperty | sip | The StyleInfoProperty that identifies the changed style property. |
Overrides
ResetBold()
Resets the Bold property.
Declaration
public void ResetBold()
ResetFacename()
Resets the Facename property.
Declaration
public void ResetFacename()
ResetGdipFont()
Reset the GDIP font.
Declaration
public void ResetGdipFont()
ResetItalic()
Resets the Italic property.
Declaration
public void ResetItalic()
ResetOrientation()
Resets the Orientation property.
Declaration
public void ResetOrientation()
ResetSize()
Resets the Size property.
Declaration
public void ResetSize()
ResetStrikeout()
Resets the Strikeout property.
Declaration
public void ResetStrikeout()
ResetUnderline()
Resets the Underline property.
Declaration
public void ResetUnderline()
ResetUnit()
Resets the Unit property.
Declaration
public void ResetUnit()
SizeInWorldUnit(Font)
Gets the em-size of the specified font object in world-units.
Declaration
public static float SizeInWorldUnit(Font font)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Font | font | The font object. |
Returns
Type | Description |
---|---|
System.Single | The size in world units. |
Remarks
If you need to have the grid clip text in cells device-independent, thus making the print output look exactly the same as screen output you should specify GraphicsUnit.World for Unit of the standard styles Font object.
Examples
In the following code snippet, the GraphicsUnit for standard font for a grid control is change to GraphicsUnit.World.
GridStyleInfo standard = model.BaseStylesMap["Standard"].StyleInfo;
Font dfont = Control.DefaultFont;
standard.Font.Unit = GraphicsUnit.World;
standard.Font.Facename = dfont.Name;
standard.Font.Size = GridFontInfo.SizeInWorldUnit(dfont);
Dim standard As GridStyleInfo = model.BaseStylesMap("Standard").StyleInfo
Dim dfont As Font = Control.DefaultFont
standard.Font.Unit = GraphicsUnit.World
standard.Font.Facename = dfont.Name
standard.Font.Size = GridFontInfo.SizeInWorldUnit(dfont)