Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxCell.Font Property

Defines the font used for this cell.

Syntax

Get

VB.NETrefFontObj = object.Font As stdole.IFontDisp
VBSet refFontObj = object.Font As IFontDisp
C#.NETstdole.IFontDisp refFontObj = object.Font;
VC++IFontDisp* refFontObj = object->GetFont();
CHRESULT object->get_Font(IFontDisp** refFontObj);

Put

VB.NETobject.let_Font(ByVal refFontObj As stdole.IFontDisp)
VBobject.Font = refFontObj As IFontDisp
C#.NETvoid object.let_Font(stdole.IFontDisp refFontObj);
VC++void object->PutFont(IFontDisp* refFontObj);
CHRESULT object->put_Font(IFontDisp* refFontObj);

PutRef

VB.NETobject.Font = refFontObj As stdole.IFontDisp
VBSet object.Font = refFontObj As IFontDisp
C#.NETstdole.IFontDisp object.Font = refFontObj;
VC++void object->PutRefFont(IFontDisp* refFontObj);
CHRESULT object->putref_Font(IFontDisp* refFontObj);

object

A SftBoxCell object.

refFontObj

Defines the font used for this cell. For information about font properties, please visit the applicable section "Using SftBox/OCX with ...".

Comments

The Font property defines the font used for this cell.

This property overrides the control's Font property, the default font. To remove an individual cell's font, set the property to Nothing (0, null, NULL) which will restore the default font defined using the Font property.

When overriding a cell's font in a fixed height combo box control, the new font size must be smaller or equal to the default font, otherwise text may be clipped vertically as the item height cannot be adjusted. Cell text is centered vertically and horizontally based on the Cell.TextVAlign and Cell.TextHAlign properties.

Examples

VB.NET

    countryList.Columns.MakeOptimal(0)
    countryList.Items.RecalcHorizontalExtent(0)
End Sub

Private Sub AddCompany(ByVal CompName As String, ByVal NotUsed1 As String, ByVal NotUsed2 As String, ByVal Address As String, ByVal City As String, ByVal State As String, ByVal ZIP As String, ByVal Country As String, ByVal Phone As String, ByVal Fax As String)
    Dim index As Integer
    index = companyList.Items.Add(CompName)
    If Country = "United States" Then
        companyList.get_Cell(index, 0).let_Font(OLECvt.ToIFontDisp(BoldFont))
        companyList.get_Cell(index, 0).Image.NETImageObject = pictureBox1.Image
        companyList.get_Cell(index, 0).ImageHAlign = SftBoxHAlignConstants.halignSftBoxRight
    End If
    companyList.get_Cell(index, 1).Text = Address
    companyList.get_Cell(index, 2).Text = City
    companyList.get_Cell(index, 3).Text = State
    companyList.get_Cell(index, 4).Text = ZIP

VB6

    CompanyList.Items.Sort -1, SortedColumn, Direction
End Sub

Private Sub AddCompany(ByVal CompName As String, ByVal NotUsed1 As String, ByVal NotUsed2 As String, ByVal Address As String, ByVal City As String, ByVal State As String, ByVal ZIP As String, ByVal Country As String, ByVal Phone As String, ByVal Fax As String)
    Dim Index As Long
    With CompanyList.Direct
        Index = .Items.Add(CompName)
        If Country = "United States" Then
            Set .Cell(Index, 0).Font = BoldFont
            Set .Cell(Index, 0).Image.Picture = PictureSpecial.Picture
            .Cell(Index, 0).ImageHAlign = halignSftBoxRight
        End If
        .Cell(Index, 1).Text = Address
        .Cell(Index, 2).Text = City
        .Cell(Index, 3).Text = State
        .Cell(Index, 4).Text = ZIP

C#

    countryList.Items.RecalcHorizontalExtent(0);
}

private void AddCompany(string CompName, string NotUsed1, string NotUsed2, string Address, string City, string State, string ZIP, string Country, string Phone, string Fax)
{
    int index;
    index = companyList.Items.Add(CompName);
    if (Country == "United States") {
        companyList.get_Cell(index, 0).let_Font(OLECvt.ToIFontDisp(BoldFont));
        companyList.get_Cell(index, 0).Image.NETImageObject = pictureBox1.Image;
        companyList.get_Cell(index, 0).PictureAlign = SftBoxAlignConstants.constSftBoxRight;
    }
    companyList.get_Cell(index, 1).Text = Address;
    companyList.get_Cell(index, 2).Text = City;
    companyList.get_Cell(index, 3).Text = State;
    companyList.get_Cell(index, 4).Text = ZIP;

C++

void CDataInputDlg::AddCompany(LPCTSTR CompName, LPCTSTR NotUsed1, LPCTSTR NotUsed2, LPCTSTR Address, LPCTSTR City, LPCTSTR State, LPCTSTR ZIP, LPCTSTR Country, LPCTSTR Phone, LPCTSTR Fax)
{
    long index;

    ISftBoxPtr vCompanyList = m_CompanyList.GetControlUnknown();
    index = vCompanyList->Items->Add(CompName);
    if (lstrcmp(Country, "United States") == 0) {
        vCompanyList->Cell[index][0]->putref_Font(m_pBoldFont);
        vCompanyList->Cell[index][0]->Image->PutRefPicture(m_pIPictureDispBullet);
        vCompanyList->Cell[index][0]->ImageHAlign = halignSftBoxRight;
    }
    vCompanyList->Cell[index][1]->Text = Address;
    vCompanyList->Cell[index][2]->Text = City;
    vCompanyList->Cell[index][3]->Text = State;
    vCompanyList->Cell[index][4]->Text = ZIP;
    vCompanyList->Cell[index][5]->Text = Country;

See Also SftBoxCell Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.