星期二, 八月 05, 2008

CComboBox::SetDroppedWidth (MFC)
WTL doesn't work exact the same but similar

CDC dc = cCombo1.GetDC();
HFONT font = cCombo1.GetFont();
HFONT oldfont = dc.SelectFont(font);
SIZE size;
...
if (dc.GetTextExtent(pds->MapName, -1, &size)){
if (size.cx > maxWidth) maxWidth = size.cx;
}
...
dc.SelectFont(oldfont);

没有评论:

发表评论