用了个CTabCtrl, 如何重命名该控件上当前选中的Tab页的标题?
(就像Excel中右键后重命名Sheet那样)
(就像Excel中右键后重命名Sheet那样)
解决方案 »
- 程序猿平时如何锻炼自己的交际能力和做兼职的?
- CString 转化16进制
- 请教DirectX方式下(即那种全屏的游戏,比如VOS等)这种游戏怎么截取他的画面,要用DirectX获取显存的方法。
- vc开发的程序的标题 总显示“无标题×××”我怎么改变它的名称??
- html2txt
- 在一个定时器里显示MessageBox,每来一个Timer消息就会出一个对话框,为什么?
- 求购源代码,价格面议:将方正小样转成rtf格式,要保持格式,一个半月内完成。
- 光盘刻录的问题??同志们请进!
- Windows的右下角显示时间的接口是什么,我想把它换成图形显示, 哪位WinAPI高手教我,谢谢!
- 动态链接库中定义的timer好像有问题
- 50分,问一个关于dll和内存问题。
- 如何在vc.net中自定义一个类并调用啊
这个问题搞了好久了,还是没有找到可以解决的办法每次用GetItem()获得Item之后,从所获得的Item中获取字符串总是报错请高手指点
/* Compile options needed: Default
*/// CMySheet is derived from CPropertySheet.
// CPage1 is derived from CPropertyPage.// METHOD ONE ======================================================
// passing the string ID to the constructor. ClassWizard does not
// generate a constructor that takes the caption ID as a parameter,
// so it may be necessary to modify the CPage1's constructor
class CPage1 : public CPropertyPage
{
// ...public:
CPage1(UINT nIDCaption = 0);// ...
};CPage1::CPage1(UINT nIDCaption) :
CPropertyPage(CMyPage::IDD, nIDCaption)
{
//{{AFX_DATA_INIT(CMyPage)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}// Use the class's constructor to pass the string ID
CMyView::ShowPropertySheet ()
{
m_pSheet = new CMySheet ("Sheet Title");
ASSERT (m_pSheet);
m_pPage1 = new CPage1(IDS_MYCAPTION); // id of string resource
ASSERT (m_pPage1); m_pSheet->DoModal ();
}// METHOD TWO ======================================================
// this shows how to change the title of a CPropertyPage before the
// call to DoModal()
CMyView::ShowPropertySheet ()
{
m_pSheet = new CMySheet ("Sheet Title");
ASSERT (m_pSheet);
m_pPage1 = new CPage1;
ASSERT (m_pPage1); m_pPage1->m_psp.dwFlags |= PSP_USETITLE;
m_pPage1->m_psp.pszTitle = _T("My Caption"); m_pSheet->DoModal ();
}// METHOD THREE ======================================================
// This function allows you to pass the index number of a
// CPropertyPage and a string to set the title to.
BOOL CMySheet::SetPageTitle (int nPage, LPTSTR pszText)
{
CTabCtrl* pTab = GetTabControl();
ASSERT (pTab); TC_ITEM ti;
ti.mask = TCIF_TEXT;
ti.pszText = pszText;
VERIFY (pTab->SetItem (nPage, &ti)); return TRUE;
}
tcItem.mask = TCIF_TEXT;
tcItem.pszText = "abc";
m_wndTabCtrl.SetItem(1,&tcItem);
这里说的是CTabCtrl,不是CPropertySheet
你这个是指定一个Item,而不是获取某个Item中的标题我们俩问的是如何获取CTabCtrl中的某一个标签的标题