Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
MyTabCtrl.cpp
Package: CButtonguitool.rar [view]
Upload User: yangxun008
Upload Date: 2008-03-25
Package Size: 3863k
Code Size: 3k
Category:
Button control
Development Platform:
Visual C++
- // MyTabCtrl.cpp : implementation file
- //
- /////////////////////////////////////////////////////
- // This class is provided as is and Ben Hill takes no
- // responsibility for any loss of any kind in connection
- // to this code.
- /////////////////////////////////////////////////////
- // Is is meant purely as a educational tool and may
- // contain bugs.
- /////////////////////////////////////////////////////
- // ben@shido.fsnet.co.uk
- // http://www.shido.fsnet.co.uk
- /////////////////////////////////////////////////////
- // Thanks to a mystery poster in the C++ forum on
- // www.codeguru.com I can't find your name to say thanks
- // for your Control drawing code. If you are that person
- // thank you very much. I have been able to use some of
- // you ideas to produce this sample application.
- /////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "Resource.h"
- #include "MyTabCtrl.h"
- #include "DlgBasic.h"
- #include "DlgAdvanced.h"
- #include "DlgTransparent.h"
- #include "DlgShadeButtonST.h"
- #include "DlgAbout.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyTabCtrl
- CMyTabCtrl::CMyTabCtrl()
- {
- ::ZeroMemory(&m_tabPages, sizeof(m_tabPages));
- m_tabPages[0]=new CDlgBasic;
- m_tabPages[1]=new CDlgAdvanced;
- m_tabPages[2]=new CDlgTransparent;
- m_tabPages[3]=new CDlgShadeButtonST;
- m_tabPages[4]=new CDlgAbout;
- m_nNumberOfPages=5;
- }
- CMyTabCtrl::~CMyTabCtrl()
- {
- for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
- delete m_tabPages[nCount];
- }
- }
- void CMyTabCtrl::Init()
- {
- m_tabCurrent=0;
- m_tabPages[0]->Create(IDD_BASIC, this);
- m_tabPages[1]->Create(IDD_ADVANCED, this);
- m_tabPages[2]->Create(IDD_TRANSPARENT, this);
- m_tabPages[3]->Create(IDD_SHADED, this);
- m_tabPages[4]->Create(IDD_ABOUT, this);
- m_tabPages[0]->ShowWindow(SW_SHOW);
- m_tabPages[1]->ShowWindow(SW_HIDE);
- m_tabPages[2]->ShowWindow(SW_HIDE);
- m_tabPages[3]->ShowWindow(SW_HIDE);
- m_tabPages[4]->ShowWindow(SW_HIDE);
- SetRectangle();
- }
- void CMyTabCtrl::SetRectangle()
- {
- CRect tabRect, itemRect;
- int nX, nY, nXc, nYc;
- GetClientRect(&tabRect);
- GetItemRect(0, &itemRect);
- nX=itemRect.left;
- nY=itemRect.bottom+1;
- nXc=tabRect.right-itemRect.left-1;
- nYc=tabRect.bottom-nY-1;
- m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
- for(int nCount=1; nCount < m_nNumberOfPages; nCount++){
- m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
- }
- }
- BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl)
- //{{AFX_MSG_MAP(CMyTabCtrl)
- ON_WM_LBUTTONDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyTabCtrl message handlers
- void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
- {
- CTabCtrl::OnLButtonDown(nFlags, point);
- if(m_tabCurrent != GetCurFocus()){
- m_tabPages[m_tabCurrent]->ShowWindow(SW_HIDE);
- m_tabCurrent=GetCurFocus();
- m_tabPages[m_tabCurrent]->ShowWindow(SW_SHOW);
- m_tabPages[m_tabCurrent]->SetFocus();
- }
- }