[ACXFAQ011]
How do I access your component font properties under Visual C++?


Using the Disp (Late Binding, Class Wizard Default) Interface

All of our components that have font properties that make it easy to deal with fonts in our components when developing under Microsoft Visual C++. To set the Font's Color property, there is a special, single property to do this...

m_iComponentX1.SetFontColor(0x0000FFFF); //Yellow Font Color

To set other Font Properties, do the following...

//Add this include statement to the top of your file
#include "font.h";

...and then do the following...

//Setup Local Variables in your code
COleFont MyFont;
CY FontSize;

//Get a copy of the font from the component
MyFont = m_iComponentX1.GetFont();

//Set the Font Size
FontSize.int64 = 240000; //Point Size 24 (24 * 10000 = 240000)
MyFont.SetSize(FontSize);

//Set the Font Name
MyFont.SetName("Times New Roman");

//Set Various Font Styles
MyFont.SetBold(TRUE);
MyFont.SetItalic(FALSE);
MyFont.SetUnderline(FALSE);
MyFont.SetStrikethrough(FALSE);

//Set the font back on the component
m_iComponentX1.SetFont(MyFont);


Using the iDispatch (Early Binding, High-Speed) Interface

All of our components that have font properties that make it easy to deal with fonts in our components when developing under Microsoft Visual C++. To set the Font's Color property, there is a special, single property to do this...

iComponentX1->SetFontColor(0x0000FFFF); //Yellow Font Color

To set other Font Properties, do the following...

//Add this include statement to the top of your file
#include "font.h";

...and then do the following...

//Setup Local Variables in your code
COleFont MyFont;
CY FontSize;

//Get a copy of the font from the component
MyFont = iComponentX1->GetFont();

//Set the Font Size
FontSize.int64 = 240000; //Point Size 24 (24 * 10000 = 240000)
MyFont.SetSize(FontSize);

//Set the Font Name
MyFont.SetName("Times New Roman");

//Set Various Font Styles
MyFont.SetBold(TRUE);
MyFont.SetItalic(FALSE);
MyFont.SetUnderline(FALSE);
MyFont.SetStrikethrough(FALSE);

//Set the font back on the component
iComponentX1->PutFont((IFontDisp *)MyFont.m_lpDispatch);


Copyright ©1998-2007 Iocomp Software Incorporated. Iocomp and the Iocomp Logo are registered trademarks of Iocomp Software Inc. All other trademarks are registered by their respective owners.