CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Posts
    15

    how can I change the fontstyle of an Item in ComboBox or DropDown Control?

    Hi,

    I want to change the fontstyle of an specific item in dropdown Control using WinAPI is that possible ?

    if yes are ther any decumentation availible ?

    thanks
    XSnack

  2. #2
    Join Date
    May 2002
    Location
    Somewhere over the rainbow
    Posts
    423
    try mabye:

    Code:
    LOGFONT LogFont;
    HFONT hFont= CreateFontIndirect(&LogFont);
    CHOOSEFONT cf = {sizeof(CHOOSEFONT)};
    COLORREF g_rgbText = RGB(0, 0, 0);
    cf.Flags = CF_EFFECTS | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
    cf.hwndOwner = hWnd;
    cf.lpLogFont = &LogFont;
    cf.rgbColors = g_rgbText;
    LogFont.lfHeight=14;
    LogFont.lfWidth=8;
    LogFont.lfEscapement=0;  // Making Font
    LogFont.lfOrientation=0;
    LogFont.lfWeight=300;
    LogFont.lfItalic=0;
    LogFont.lfUnderline=0;
    LogFont.lfStrikeOut=0;
    LogFont.lfCharSet=1;
    LogFont.lfOutPrecision=OUT_TT_PRECIS;
    LogFont.lfClipPrecision=CLIP_DEFAULT_PRECIS;
    LogFont.lfQuality=DRAFT_QUALITY;
    LogFont.lfPitchAndFamily=FF_MODERN;
    
    if(ChooseFont(&cf))
    {
    HFONT hf = CreateFontIndirect(&LogFont);
    if(hf)
    {
    hFont = hf;
    SendDlgItemMessage(hWnd, YOUR_ID, WM_SETFONT, (WPARAM)hFont, TRUE);
    }
    }
    as for specific item,
    there could be an SETITEMTEXT message, check it out
    Bengi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured