CFONT型からLPDISPATCH型に変換するプログラムを以下に示します。このプログラムは、CFontオブジェクトを作成し、そのオブジェクトを使用してデバイスコンテキストにフォントを選択し、最後にフォントオブジェクトを削除します。
LPDISPATCH ConvertCFontToLPDISPATCH(CFont& font)
{
LPDISPATCH lpDispatch = NULL;
COleDispatchDriver dispDriver;
dispDriver.CreateDispatch(_T("Font"));
dispDriver.SetProperty(0x1, VT_I2, (short)font.GetPointSize());
dispDriver.SetProperty(0x2, VT_BSTR, font.GetFaceName());
dispDriver.SetProperty(0x3, VT_BOOL, font.GetBold());
dispDriver.SetProperty(0x4, VT_BOOL, font.GetItalic());
dispDriver.SetProperty(0x5, VT_BOOL, font.GetUnderline());
dispDriver.SetProperty(0x6, VT_BOOL, font.GetStrikeOut());
dispDriver.SetProperty(0x7, VT_I2, (short)font.GetCharSet());
dispDriver.SetProperty(0x8, VT_I4, font.GetOrientation());
dispDriver.SetProperty(0x9, VT_I4, font.GetWeight());
dispDriver.SetProperty(0xa, VT_I4, font.GetEscapement());
dispDriver.SetProperty(0xb, VT_I4, font.GetWidth());
dispDriver.SetProperty(0xc, VT_I4, font.GetPitchAndFamily());
lpDispatch = dispDriver.m_lpDispatch;
return lpDispatch;
}
0 件のコメント:
コメントを投稿