

| Type | Description | |||
| Item as HITEM | A long expression that specifies the item's handle. | |||
| IFontDisp | A Font object that specifies the item's font. |
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 CellCaptionFormat 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.
The
following VB sample changes the font for the focused item:
With Gantt1.Items
.ItemFont(.FocusItem) = Gantt1.Font
With .ItemFont(.FocusItem)
.Name = "Comic Sans MS"
.Bold = True
End With
End With
Gantt1.RefreshThe following C++ sample changes the font for the focused item:
#include "Items.h" #include "Font.h" CItems items = m_gantt.GetItems(); items.SetItemFont( items.GetFocusItem(), m_gantt.GetFont().m_lpDispatch ); COleFont font = items.GetItemFont( items.GetFocusItem() ); font.SetName( "Comic Sans MS" ); font.SetBold( TRUE ); m_gantt.Refresh();
The following VB.NET sample changes the font for the focused item:
With AxGantt1.Items
.ItemFont(.FocusItem) = IFDH.GetIFontDisp(AxGantt1.Font)
With .ItemFont(.FocusItem)
.Name = "Comic Sans MS"
.Bold = True
End With
End With
AxGantt1.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 ClassThe following C# sample changes the font for the focused item:
axGantt1.Items.set_ItemFont( axGantt1.Items.FocusItem, IFDH.GetIFontDisp( axGantt1.Font ) ); stdole.IFontDisp spFont = axGantt1.Items.get_ItemFont(axGantt1.Items.FocusItem ); spFont.Name = "Comic Sans MS"; spFont.Bold = true; axGantt1.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.Gantt1.Items .DefaultItem = .FocusItem .ItemFont(0) = thisform.Gantt1.Font with .ItemFont(0) .Name = "Comic Sans MS" .Bold = .t. endwith endwith thisform.Gantt1.Object.Refresh()