WinForms

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridFontInfo - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    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
    System.Object
    ShouldSerializeBasedPersisterType
    StyleInfoBase
    StyleInfoSubObjectBase
    GridStyleInfoSubObject
    GridFontInfo
    Implements
    System.ComponentModel.ICustomTypeDescriptor
    System.IDisposable
    IStyleInfo
    System.ComponentModel.ISupportInitialize
    System.IFormattable
    System.IConvertible
    System.Xml.Serialization.IXmlSerializable
    IStyleInfoSubObject
    Inherited Members
    GridStyleInfoSubObject.GetGridStyleInfo()
    GridStyleInfoSubObject.GetCellIdentity()
    GridStyleInfoSubObject.GetGridModel()
    GridStyleInfoSubObject.GetActiveGridView()
    GridStyleInfoSubObject.ToString()
    GridStyleInfoSubObject.Info
    StyleInfoSubObjectBase.IntGetDefaultStyleInfo(StyleInfoProperty)
    StyleInfoSubObjectBase.SubObjectIdentity
    StyleInfoSubObjectBase.Sip
    StyleInfoSubObjectBase.Data
    StyleInfoSubObjectBase.Owner
    StyleInfoBase.WriteXml(XmlWriter)
    StyleInfoBase.ReadXml(XmlReader)
    StyleInfoBase.SetStore(StyleInfoStore)
    StyleInfoBase.ClearCache()
    StyleInfoBase.Dispose()
    StyleInfoBase.Equals(Object)
    StyleInfoBase.EqualsObject(Object, Object)
    StyleInfoBase.GetHashCode()
    StyleInfoBase.ToString(String)
    StyleInfoBase.ToString(String, IFormatProvider)
    StyleInfoBase.ParseString(String)
    StyleInfoBase.BeginInit()
    StyleInfoBase.EndInit()
    StyleInfoBase.BeginUpdate()
    StyleInfoBase.EndUpdate()
    StyleInfoBase.CreateSubObjectIdentity(StyleInfoProperty)
    StyleInfoBase.GetDefaultStyleInfoStore(StyleInfoProperty)
    StyleInfoBase.OnStyleChanging(StyleInfoProperty)
    StyleInfoBase.IsSubset(IStyleInfo)
    StyleInfoBase.CopyFrom(IStyleInfo)
    StyleInfoBase.ModifyStyle(IStyleInfo, StyleModifyType)
    StyleInfoBase.InheritStyle(IStyleInfo, StyleModifyType)
    StyleInfoBase.MergeStyle(IStyleInfo)
    StyleInfoBase.HasValue(StyleInfoProperty)
    StyleInfoBase.IsValueModified(StyleInfoProperty)
    StyleInfoBase.ResetValue(StyleInfoProperty)
    StyleInfoBase.GetValue(StyleInfoProperty)
    StyleInfoBase.GetDefaultValue(StyleInfoProperty)
    StyleInfoBase.GetShortValue(StyleInfoProperty)
    StyleInfoBase.SetValue(StyleInfoProperty, Object)
    StyleInfoBase.SetValue(StyleInfoProperty, Int16)
    StyleInfoBase.IConvertible.ToUInt64(IFormatProvider)
    StyleInfoBase.IConvertible.ToSByte(IFormatProvider)
    StyleInfoBase.IConvertible.ToDouble(IFormatProvider)
    StyleInfoBase.IConvertible.ToDateTime(IFormatProvider)
    StyleInfoBase.IConvertible.ToSingle(IFormatProvider)
    StyleInfoBase.IConvertible.ToBoolean(IFormatProvider)
    StyleInfoBase.IConvertible.ToInt32(IFormatProvider)
    StyleInfoBase.IConvertible.ToUInt16(IFormatProvider)
    StyleInfoBase.IConvertible.ToInt16(IFormatProvider)
    StyleInfoBase.IConvertible.ToString(IFormatProvider)
    StyleInfoBase.IConvertible.ToByte(IFormatProvider)
    StyleInfoBase.IConvertible.ToChar(IFormatProvider)
    StyleInfoBase.IConvertible.ToInt64(IFormatProvider)
    StyleInfoBase.IConvertible.GetTypeCode()
    StyleInfoBase.IConvertible.ToDecimal(IFormatProvider)
    StyleInfoBase.IConvertible.ToType(Type, IFormatProvider)
    StyleInfoBase.IConvertible.ToUInt32(IFormatProvider)
    StyleInfoBase.Identity
    StyleInfoBase.Store
    StyleInfoBase.CacheValues
    StyleInfoBase.WeakReferenceChangedListeners
    StyleInfoBase.Updating
    StyleInfoBase.IsEmpty
    StyleInfoBase.IsChanged
    StyleInfoBase.Changed
    StyleInfoBase.Changing
    ShouldSerializeBasedPersisterType.GetNewAttributesCount(PropertyDescriptor)
    ShouldSerializeBasedPersisterType.AddNewAttributes(PropertyDescriptor, Attribute[], Int32)
    ShouldSerializeBasedPersisterType.GetCustomPDC(PropertyDescriptorCollection)
    ShouldSerializeBasedPersisterType.CheckAllProperties
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    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 Description
    System.Boolean

    Default

    Gets a default GridFontInfo to be used with a default style.

    Declaration
    public static GridFontInfo Default { get; }
    Property Value
    Type Description
    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 Description
    System.String

    FontStyle

    Gets or sets style information for the font.

    Declaration
    public FontStyle FontStyle { get; set; }
    Property Value
    Type Description
    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 Description
    System.Drawing.Font

    HasBold

    Gets a value indicating whether the Bold property has been initialized.

    Declaration
    public bool HasBold { get; }
    Property Value
    Type Description
    System.Boolean

    HasFacename

    Gets a value indicating whether the Facename property has been initialized.

    Declaration
    public bool HasFacename { get; }
    Property Value
    Type Description
    System.Boolean

    HasItalic

    Gets a value indicating whether the Italic property has been initialized.

    Declaration
    public bool HasItalic { get; }
    Property Value
    Type Description
    System.Boolean

    HasOrientation

    Gets a value indicating whether the Orientation property has been initialized.

    Declaration
    public bool HasOrientation { get; }
    Property Value
    Type Description
    System.Boolean

    HasSize

    Gets a value indicating whether the Size property has been initialized.

    Declaration
    public bool HasSize { get; }
    Property Value
    Type Description
    System.Boolean

    HasStrikeout

    Gets a value indicating whether the Strikeout property has been initialized.

    Declaration
    public bool HasStrikeout { get; }
    Property Value
    Type Description
    System.Boolean

    HasUnderline

    Gets a value indicating whether the Underline property has been initialized.

    Declaration
    public bool HasUnderline { get; }
    Property Value
    Type Description
    System.Boolean

    HasUnit

    Gets a value indicating whether the Unit property has been initialized.

    Declaration
    public bool HasUnit { get; }
    Property Value
    Type Description
    System.Boolean

    Italic

    Gets or sets a value indicating whether this GridFontInfo object is italic.

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

    Orientation

    Gets or sets the orientation of this GridFontInfo object.

    Declaration
    public int Orientation { get; set; }
    Property Value
    Type Description
    System.Int32

    Size

    Gets or sets the size in pixels of this GridFontInfo object.

    Declaration
    public float Size { get; set; }
    Property Value
    Type Description
    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 Description
    System.Boolean

    Underline

    Gets or sets a value indicating whether this GridFontInfo object is underlined.

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

    Unit

    Gets or sets the graphics unit of this GridFontInfo object.

    Declaration
    public GraphicsUnit Unit { get; set; }
    Property Value
    Type Description
    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
    StyleInfoSubObjectBase.Dispose(Boolean)

    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
    StyleInfoBase.GetDefaultStyle()

    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
    StyleInfoSubObjectBase.MakeCopy(StyleInfoBase, StyleInfoProperty)

    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
    StyleInfoSubObjectBase.OnStyleChanged(StyleInfoProperty)

    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)

    Implements

    System.ComponentModel.ICustomTypeDescriptor
    System.IDisposable
    IStyleInfo
    System.ComponentModel.ISupportInitialize
    System.IFormattable
    System.IConvertible
    System.Xml.Serialization.IXmlSerializable
    IStyleInfoSubObject
    Back to top Generated by DocFX
    Copyright © 2001 - 2022 Syncfusion Inc. All Rights Reserved