Click to See Complete Forum and Search --> : how can I change the fontstyle of an Item in ComboBox or DropDown Control?


XSnack
February 6th, 2003, 04:21 AM
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

Bengi
February 6th, 2003, 05:25 PM
try mabye:


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