Hi,
I create two CStatic controls. One property is set to transparent mode; another one is normal. After I change font size, one is OK, it is changed, but the set transparent mode one is not changed in size.
Does anybody know why ?
Thanks.
//////////////////////////////////////////////////
// Resource File
LTEXT "This Is Normal Text.",IDC_FONT2,7,119,303,21,WS_BORDER
LTEXT "This Include Transparent.",IDC_FONT,7,7,306,21,WS_BORDER | NOT WS_GROUP | WS_TABSTOP,WS_EX_TRANSPARENT
// FontTest.CPP
class CFontSizeDlg : public CDialogEx
{
public:
CStatic m_myFont;
CStatic m_myFont2;
}
// FontTest.CPP
void CFontSizeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_FONT, m_myFont);
DDX_Control(pDX, IDC_FONT2, m_myFont2);
}
void CFontSizeDlg::OnBnClickedButton2()
{
CFont hNewFont;
LOGFONT lf; // Used to create the CFont.
CFont *currentFont = GetFont();
currentFont->GetLogFont(&lf);
lf.lfHeight = 25;
lf.lfWidth = 10;
hNewFont.DeleteObject();
hNewFont.CreateFontIndirect(&lf); // Create the font.
// Use the font to paint a control.
m_myFont2.SetFont(&hNewFont);
m_myFont.SetFont(&hNewFont);
// hNewFont.Detach();
hNewFont.DeleteObject();
}