property Items.ItemFont (Item as HITEM) as IFontDisp
Retrieves or sets the item's font.

TypeDescription
Item as HITEM A long expression that indicates the item's handle.
IFontDisp A font object being used.

By default, the ItemFont property is nothing. If the ItemFont property is nothing, the item uses the control's font. Use the ItemFont property to define a different font for the item. Use the CellFont and ItemFont properties to specify different fonts for cells or items. Use the CellBold, CellItalic, CellUnderline, CellStrikeout, ItemBold, ItemUnderline, ItemStrikeout, ItemItalic or CellValueFormat to specify different font attributes. Use the ItemHeight property to specify the height of the item. Use the Refresh method to refresh the control's content on the fly. Use the BeginUpdate and EndUpdate methods if you are doing multiple changes, so no need for an update each time a change is done. Use the ItemHeight property to specify the height of the item.

The following VB sample changes the font for the focused item:

With Grid1.Items
    .ItemFont(.FocusItem) = Grid1.Font
    With .ItemFont(.FocusItem)
        .Name = "Comic Sans MS"
        .Bold = True
    End With
End With
Grid1.Refresh

The following C++ sample changes the font for the focused item:

#include "Items.h"
#include "Font.h"
CItems items = m_grid.GetItems();
items.SetItemFont( items.GetFocusItem(), m_grid.GetFont().m_lpDispatch );
COleFont font = items.GetItemFont( items.GetFocusItem() );
font.SetName( "Comic Sans MS" );
font.SetBold( TRUE );
m_grid.Refresh();

The following VB.NET sample changes the font for the focused item:

With AxGrid1.Items
    .ItemFont(.FocusItem) = IFDH.GetIFontDisp(AxGrid1.Font)
    With .ItemFont(.FocusItem)
        .Name = "Comic Sans MS"
        .Bold = True
    End With
End With
AxGrid1.CtlRefresh()

where the IFDH class is defined like follows:

Public Class IFDH
    Inherits System.Windows.Forms.AxHost

    Sub New()
        MyBase.New("")
    End Sub

    Public Shared Function GetIFontDisp(ByVal font As Font) As Object
        GetIFontDisp = AxHost.GetIFontFromFont(font)
    End Function

End Class

The following C# sample changes the font for the focused item:

axGrid1.Items.set_ItemFont( axGrid1.Items.FocusItem, IFDH.GetIFontDisp( axGrid1.Font ) );
stdole.IFontDisp spFont = axGrid1.Items.get_ItemFont(axGrid1.Items.FocusItem );
spFont.Name = "Comic Sans MS";
spFont.Bold = true;
axGrid1.CtlRefresh();

where the IFDH class is defined like follows:

internal class IFDH : System.Windows.Forms.AxHost
{
	public IFDH() : base("")
	{
	}

	public static stdole.IFontDisp GetIFontDisp(System.Drawing.Font font)
	{
		return System.Windows.Forms.AxHost.GetIFontFromFont(font) as stdole.IFontDisp;
	}
}

The following VFP sample changes the font for the focused item:

with thisform.Grid1.Items
	.DefaultItem = .FocusItem
	.ItemFont(0) = thisform.Grid1.Font
	with .ItemFont(0)
		.Name = "Comic Sans MS"
		.Bold = .t.
	endwith
endwith
thisform.Grid1.Object.Refresh()