property Grid.Font as IFontDisp
Retrieves or sets the control's font.

 TypeDescription 
   IFontDisp A Font object that defines the control's font.  

Use the Font object to change the control's font. Use the CellBold, CellItalic, CellUnderline, and CellStrikeOut properties to apply font attributes to cells. Use the ItemBold, ItemItalic, ItemUnderline, and ItemStrikeOut properties to apply font attributes to items. Use the HeaderBold, HeaderItalic, HeaderUnderline and HeaderStrikeOut properties to apply font attributes to the column header. Use the FilterBarFont property to assign a different font for the control's filter bar. Use the Refresh method to refresh the control. Use the BeginUpdate and EndUpdate method to maintain performance while adding new columns or items.

The following VB sample assigns by code a new font to the control:

With Grid1
    With .Font
        .Name = "Tahoma"
    End With
    .Refresh
End With

The following C++ sample assigns by code a new font to the control:

COleFont font = m_grid.GetFont();
font.SetName( "Tahoma" );
m_grid.Refresh();

the C++ sample requires definition of COleFont class ( #include "Font.h" )

The following VB.NET sample assigns by code a new font to the control:

With AxGrid1
    Dim font As System.Drawing.Font = New System.Drawing.Font("Tahoma", 10, FontStyle.Regular, GraphicsUnit.Point)
    .Font = font
    .CtlRefresh()
End With

The following C# sample assigns by code a new font to the control:

System.Drawing.Font font = new System.Drawing.Font("Tahoma", 10, FontStyle.Regular);
axGrid1.Font = font;
axGrid1.CtlRefresh();

The following VFP sample assigns by code a new font to the control:

with thisform.Grid1.Object
	.Font.Name = "Tahoma"
	.Refresh()
endwith

The following Template sample assigns by code a new font to the control:

Font
{
	Name = "Tahoma"
}

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.