vc,如何给Tab Control控件添加图标
2个回答
展开全部
static UINT nID = MYTABCTRL_START;
BOOL ret = CWnd::Create(NULL ,NULL ,WS_VISIBLE |WS_CHILD , rect ,pParentWnd , ++nID );
int nCount = m_btnPtrList.GetSize();
int nTmp = 3;
int d = 5;
CMyButton * pBtn = NULL;
CWnd * pDlg = NULL;
CSize sz(0 , 0);
for(int i = 0 ; i < nCount ; i++)
{
pBtn = m_btnPtrList.GetAt(i);
pDlg = m_dlgPtrList.GetAt(i);
pBtn->Create(m_strTextList.GetAt(i) ,WS_VISIBLE |WS_CHILD|BS_RADIOBUTTON ,
CRect(0 , 0 , 0 , 0),this ,++nID);
((CDialog *)pDlg) ->Create(m_nDlgID.GetAt(i) , this);
sz = pBtn->SetBmpID(IDB_BITMAP1);//IDB_BMP_BTNTAB);
pBtn->MySetTextColor(0x00faf0d7);
m_rtDlg.top = sz.cy ;
m_rtDlg.left = 0 ;
m_rtDlg.bottom = rect.Height();
m_rtDlg.right = rect.Width();
CRect rect(nTmp , 0 , sz.cx + nTmp, sz.cy);
pBtn->MoveWindow(&rect);
pDlg->MoveWindow(&m_rtDlg);
if(i == m_nCurrentIndex)
pDlg->ShowWindow(SW_SHOW);
nTmp +=(sz.cx + d);
}
pBtn = m_btnPtrList.GetAt(0);
if(NULL != pBtn)
pBtn->MySetCheck(TRUE);
BOOL ret = CWnd::Create(NULL ,NULL ,WS_VISIBLE |WS_CHILD , rect ,pParentWnd , ++nID );
int nCount = m_btnPtrList.GetSize();
int nTmp = 3;
int d = 5;
CMyButton * pBtn = NULL;
CWnd * pDlg = NULL;
CSize sz(0 , 0);
for(int i = 0 ; i < nCount ; i++)
{
pBtn = m_btnPtrList.GetAt(i);
pDlg = m_dlgPtrList.GetAt(i);
pBtn->Create(m_strTextList.GetAt(i) ,WS_VISIBLE |WS_CHILD|BS_RADIOBUTTON ,
CRect(0 , 0 , 0 , 0),this ,++nID);
((CDialog *)pDlg) ->Create(m_nDlgID.GetAt(i) , this);
sz = pBtn->SetBmpID(IDB_BITMAP1);//IDB_BMP_BTNTAB);
pBtn->MySetTextColor(0x00faf0d7);
m_rtDlg.top = sz.cy ;
m_rtDlg.left = 0 ;
m_rtDlg.bottom = rect.Height();
m_rtDlg.right = rect.Width();
CRect rect(nTmp , 0 , sz.cx + nTmp, sz.cy);
pBtn->MoveWindow(&rect);
pDlg->MoveWindow(&m_rtDlg);
if(i == m_nCurrentIndex)
pDlg->ShowWindow(SW_SHOW);
nTmp +=(sz.cx + d);
}
pBtn = m_btnPtrList.GetAt(0);
if(NULL != pBtn)
pBtn->MySetCheck(TRUE);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询