G
Guest
Greetings,
Am trying to change the font of a CTabCtrl I have in my Main Frame Window
(not a Dialog Box).
Since CTabCtrl is based in CWnd, I figured that SetFont() should work.
No luck. And there are no CTabCtrl member functions specifically for
changing the font.
My code looks like this. The Tabs work fine. I just can't change the size.
Any idea what I am doing wrong???
Thanks,
Mike
************************************************
class CMainFrame : public CFrameWnd
{
public:
CTabCtrl myTab;
************************************************
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CRect r;
GetClientRect(&r);
myTab.Create(TCS_TABS |TCS_BOTTOM|TCS_MULTILINE ,r, this, 2345);
CFont font;
font.CreateFont( 10, 0, 0, 0,FW_NORMAL,0,0,0,0,0,0,0,0, "Arial"));
myTab.SetFont(&font,TRUE);
TC_ITEM T;
T.mask = TCIF_TEXT;
T.pszText = "PLOT 1"; myTab.InsertItem(0, &T );
T.pszText = "PLOT 2"; myTab.InsertItem(1, &T );
T.pszText = "PLOT 3"; myTab.InsertItem(2, &T );
T.pszText = "PLOT 4"; myTab.InsertItem(3, &T );
myTab.ShowWindow(SW_SHOWNORMAL);
return 0;
}
Am trying to change the font of a CTabCtrl I have in my Main Frame Window
(not a Dialog Box).
Since CTabCtrl is based in CWnd, I figured that SetFont() should work.
No luck. And there are no CTabCtrl member functions specifically for
changing the font.
My code looks like this. The Tabs work fine. I just can't change the size.
Any idea what I am doing wrong???
Thanks,
Mike
************************************************
class CMainFrame : public CFrameWnd
{
public:
CTabCtrl myTab;
************************************************
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CRect r;
GetClientRect(&r);
myTab.Create(TCS_TABS |TCS_BOTTOM|TCS_MULTILINE ,r, this, 2345);
CFont font;
font.CreateFont( 10, 0, 0, 0,FW_NORMAL,0,0,0,0,0,0,0,0, "Arial"));
myTab.SetFont(&font,TRUE);
TC_ITEM T;
T.mask = TCIF_TEXT;
T.pszText = "PLOT 1"; myTab.InsertItem(0, &T );
T.pszText = "PLOT 2"; myTab.InsertItem(1, &T );
T.pszText = "PLOT 3"; myTab.InsertItem(2, &T );
T.pszText = "PLOT 4"; myTab.InsertItem(3, &T );
myTab.ShowWindow(SW_SHOWNORMAL);
return 0;
}