/[H6]/MyTabCtrl.cpp
ViewVC logotype

Annotation of /MyTabCtrl.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (hide annotations) (download)
Wed Aug 30 08:01:57 2006 UTC (17 years, 8 months ago) by torben
File size: 1694 byte(s)
Tilføjet CMyTabCtrl
1 torben 4 // MyTabCtrl.cpp : implementation file
2     //
3    
4     #include "stdafx.h"
5     #include "h6-udlånssystem.h"
6     #include "MyTabCtrl.h"
7     #include ".\mytabctrl.h"
8    
9    
10     // CMyTabCtrl
11    
12     IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl)
13     CMyTabCtrl::CMyTabCtrl()
14     {
15     m_numTabs = 3;
16     m_tabs[0] = new CDialog;
17     m_tabs[1] = new CDialog;
18     m_tabs[2] = new CDialog;
19     }
20    
21     CMyTabCtrl::~CMyTabCtrl()
22     {
23     for (int i=0; i<m_numTabs; i++)
24     delete m_tabs[i];
25     }
26    
27    
28     BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl)
29     //{{AFX_MSG_MAP(CMyTabCtrl)
30     ON_WM_LBUTTONDOWN()
31     //}}AFX_MSG_MAP
32     END_MESSAGE_MAP()
33    
34    
35    
36     // CMyTabCtrl message handlers
37    
38    
39     void CMyTabCtrl::Init(void)
40     {
41     OutputDebugString("CMyTabCtrl::Init()\n");
42    
43     m_tabCurrent = 0;
44    
45     m_tabs[0]->Create(IDD_SEARCH);
46     m_tabs[1]->Create(IDD_SEARCH);
47     m_tabs[2]->Create(IDD_SEARCH);
48    
49     m_tabs[0]->ShowWindow(SW_SHOW);
50     m_tabs[1]->ShowWindow(SW_HIDE);
51     m_tabs[2]->ShowWindow(SW_HIDE);
52     SetRectangle();
53    
54     }
55    
56     void CMyTabCtrl::SetRectangle(void)
57     {
58     CRect tabRect, itemRect;
59     int nX,nY,nXc,nYc;
60    
61     GetClientRect(&tabRect);
62     GetItemRect(0, &itemRect);
63    
64     nX = itemRect.left+10;
65     nY = itemRect.bottom+15;
66     nXc=tabRect.right-itemRect.left-1;
67     nYc=tabRect.bottom-nY-1;
68    
69     m_tabs[0]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_SHOWWINDOW);
70     for (int i=1; i<m_numTabs; i++) {
71     m_tabs[i]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_HIDEWINDOW);
72     }
73    
74     }
75     void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
76     {
77     CTabCtrl::OnLButtonDown(nFlags,point);
78    
79     if (m_tabCurrent != GetCurFocus()) {
80     m_tabs[m_tabCurrent]->ShowWindow(SW_HIDE);
81     m_tabCurrent = GetCurFocus();
82     m_tabs[m_tabCurrent]->ShowWindow(SW_SHOW);
83     m_tabs[m_tabCurrent]->SetFocus();
84     }
85     }
86    
87    

  ViewVC Help
Powered by ViewVC 1.1.20