Defines the font used to display the caption.
Get
| C# | stdole.IFontDisp refFontObj = object.Font; |
| VB.NET | refFontObj = object.Font As stdole.IFontDisp![]() |
| C++ | IFontDisp* refFontObj = object->GetFont(); |
| C | HRESULT object->get_Font(IFontDisp** refFontObj); |
Put
PutRef
| C# | stdole.IFontDisp object.Font = refFontObj; |
| VB.NET | object.Font = refFontObj As stdole.IFontDisp![]() |
| C++ | void object->PutRefFont(IFontDisp* refFontObj); |
| C | HRESULT object->putref_Font(IFontDisp* refFontObj); |
object
refFontObj
Defines the font used to display the caption.
The Font property defines the font used to display the caption.
The font used for the edit control portion is defined using the control's Font property.
If the AutoSize property is set to True, the height of the control is automatically adjusted to allow the complete caption text to be displayed.
Using PutRef (see Syntax above) the control will use the reference to the Font object. If the Font object is later changed, this will also affect the font used by the control. Using Put instead, causes the control to create a copy of the Font object. If the Font object is later changed, this will not affect the font used by the control as it uses a copy of the object. Because of the additional overhead and the increased resource use of Put, PutRef is the preferred method.
private void Form1_Load(object sender, System.EventArgs e)
{
Font BoldFont = new Font("Times New Roman", 12, FontStyle.Bold);
axSftMask1.Font = BoldFont;
Font NormFont = new Font("Times New Roman", 12, FontStyle.Regular);
axSftMask1.Caption.Font = OLECvt.ToIFontDisp(NormFont);
SftMaskCalculator CalcObj = axSftMask1.Calculator;
axSftMask1.Caption.SizePercent = 33;
axSftMask1.Caption.Text = "&Amount:";
axSftMask1.Mask = "| $C-,8.2";
axSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight;
axSftMask1.EntrySelect = SftMaskEntrySelectConstants.entrySftMaskSelectEnd;
axSftMask1.Text = "10";
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim BoldFont As New Font("Times New Roman", 12, FontStyle.Bold) AxSftMask1.Font = BoldFont Dim NormFont As New Font("Times New Roman", 12, FontStyle.Regular) AxSftMask1.Caption.Font = OLECvt.ToIFontDisp(NormFont) Dim CalcObj As SftMaskCalculator AxSftMask1.Caption.SizePercent = 33 AxSftMask1.Caption.Text = "&Amount:" AxSftMask1.Mask = "| $C-,8.2" AxSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight AxSftMask1.EntrySelect = SftMaskEntrySelectConstants.entrySftMaskSelectEnd AxSftMask1.Text = 10 CalcObj = AxSftMask1.Calculator CalcObj.Lines = 12 CalcObj.FracDigits = 2
IFontDispPtr pFontDisp = m_pMask1->GetFont();
IFontPtr pFont = pFontDisp;
pFont->put_Name(L"Times New Roman");
pFont->put_Bold(TRUE);
CY size;
size.int64 = 12*10000L; //12 point font
pFont->put_Size(size);
pFontDisp = m_pMask1->Caption->GetFont();
pFont = pFontDisp;
pFont->put_Name(L"Times New Roman");
pFont->put_Bold(FALSE);
size.int64 = 12*10000L; //12 point font
pFont->put_Size(size);
ISftMaskCalculatorPtr pCalc;See Also SftMaskCaption Object | Object Hierarchy