jifu 的个人资料jifu的共享空间日志列表留言簿更多 ![]() | 帮助 |
|
|
6月19日 Creating a CTabCtrl Application
Ben Hill (view profile)
Environment: VC6 SP3, NT4, Windows 2000 Pro, Windows 2000 Server Firstly add the CMyTabCtrl.cpp and CMyTabCtrl.h to your project. Using Visual Studio add a CTabCtrl control to your dialog. Add a member variable for this control as a CMyTabCtrl type not a simple CTabCtrl. CMyTabCtrl is derived from CTabCtrl. You can simply add a CTabCtrl member variable and manually edit the file to become CMyTabCtrl Now create dialogs for every page you require. These must be child dialogs with no border. Any controls here in these dialogs are handled by their own class. Create a Class for each dialog. In the example these are CTabOne, CTabTwo and CTabThree. In the CmyTabCtrl constructor you must add a new for each page. Also in the Init function you must specify all tab dialogs to hide all but one In this example the OnLButtonDown message handler is used to show and hide the various dialogs. The page is managed with a variable m_tabCurrent which holds the value of selected pages. In the main app dialogs OnInitDialog message handler add the tabs you require for your dialog. In this example these are Tab One, Tab Two and Tab Three. Functionality for the left and right cursor keys to select the tabs can be added in the CMyTabCtrl class. CMyTabCtrl::CMyTabCtrl() m_nNumberOfPages=3; CMyTabCtrl::~CMyTabCtrl() void CMyTabCtrl::Init() m_tabPages[0]->Create(IDD_TAB_ONE, this); m_tabPages[0]->ShowWindow(SW_SHOW); SetRectangle(); void CMyTabCtrl::SetRectangle() GetClientRect(&tabRect); nX=itemRect.left; m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW); ////////////////////////////////////////////////////// void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point) if(m_tabCurrent != GetCurFocus()){ If it was you then please let me know and I will have your name added I hope this code is of some use. It has helped me to develop much more complex dialogs. 原帖地址:http://www.codeguru.com/Cpp/controls/controls/tabcontrols/article.php/c5239 6月18日 VC中读写ini文件我们写的程序当中,总有一些配置信息需要保存下来,以便完成程序的功能,最简单的办法就是将这些信息写入INI文件中,程序初始化时再读入.具体应用如下: |
|
|