/[H6]/h6-udlånssystemDlg.cpp
ViewVC logotype

Contents of /h6-udlånssystemDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download)
Wed Aug 30 08:01:57 2006 UTC (17 years, 7 months ago) by torben
File size: 3669 byte(s)
Tilføjet CMyTabCtrl
1 // h6-udlånssystemDlg.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "h6-udlånssystem.h"
6 #include "h6-udlånssystemDlg.h"
7 #include ".\h6-udlånssystemdlg.h"
8
9 #ifdef _DEBUG
10 #define new DEBUG_NEW
11 #endif
12
13
14 // CAboutDlg dialog used for App About
15
16 class CAboutDlg : public CDialog
17 {
18 public:
19 CAboutDlg();
20
21 // Dialog Data
22 enum { IDD = IDD_ABOUTBOX };
23
24 protected:
25 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
26
27 // Implementation
28 protected:
29 DECLARE_MESSAGE_MAP()
30 };
31
32 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
33 {
34 }
35
36 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
37 {
38 CDialog::DoDataExchange(pDX);
39 }
40
41 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
42 END_MESSAGE_MAP()
43
44
45 // Ch6udlnssystemDlg dialog
46
47
48
49 Ch6udlnssystemDlg::Ch6udlnssystemDlg(CWnd* pParent /*=NULL*/)
50 : CDialog(Ch6udlnssystemDlg::IDD, pParent)
51 {
52 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
53 }
54
55 void Ch6udlnssystemDlg::DoDataExchange(CDataExchange* pDX)
56 {
57 CDialog::DoDataExchange(pDX);
58 DDX_Control(pDX, IDC_TAB, m_tabs);
59 }
60
61 BEGIN_MESSAGE_MAP(Ch6udlnssystemDlg, CDialog)
62 ON_WM_SYSCOMMAND()
63 ON_WM_PAINT()
64 ON_WM_QUERYDRAGICON()
65 //}}AFX_MSG_MAP
66 ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
67 END_MESSAGE_MAP()
68
69
70 // Ch6udlnssystemDlg message handlers
71
72 BOOL Ch6udlnssystemDlg::OnInitDialog()
73 {
74 CDialog::OnInitDialog();
75
76 // Add "About..." menu item to system menu.
77
78 // IDM_ABOUTBOX must be in the system command range.
79 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
80 ASSERT(IDM_ABOUTBOX < 0xF000);
81
82 CMenu* pSysMenu = GetSystemMenu(FALSE);
83 if (pSysMenu != NULL)
84 {
85 CString strAboutMenu;
86 strAboutMenu.LoadString(IDS_ABOUTBOX);
87 if (!strAboutMenu.IsEmpty())
88 {
89 pSysMenu->AppendMenu(MF_SEPARATOR);
90 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
91 }
92 }
93
94 // Set the icon for this dialog. The framework does this automatically
95 // when the application's main window is not a dialog
96 SetIcon(m_hIcon, TRUE); // Set big icon
97 SetIcon(m_hIcon, FALSE); // Set small icon
98
99 m_tabs.InsertItem(0,"Search");
100 m_tabs.InsertItem(1,"Result");
101 m_tabs.InsertItem(2,"Administration");
102 m_tabs.Init();
103 m_tabs.SetCurSel(0);
104
105 // TODO: Add extra initialization here
106
107 return TRUE; // return TRUE unless you set the focus to a control
108 }
109
110 void Ch6udlnssystemDlg::OnSysCommand(UINT nID, LPARAM lParam)
111 {
112 if ((nID & 0xFFF0) == IDM_ABOUTBOX)
113 {
114 CAboutDlg dlgAbout;
115 dlgAbout.DoModal();
116 }
117 else
118 {
119 CDialog::OnSysCommand(nID, lParam);
120 }
121 }
122
123 // If you add a minimize button to your dialog, you will need the code below
124 // to draw the icon. For MFC applications using the document/view model,
125 // this is automatically done for you by the framework.
126
127 void Ch6udlnssystemDlg::OnPaint()
128 {
129 if (IsIconic())
130 {
131 CPaintDC dc(this); // device context for painting
132
133 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
134
135 // Center icon in client rectangle
136 int cxIcon = GetSystemMetrics(SM_CXICON);
137 int cyIcon = GetSystemMetrics(SM_CYICON);
138 CRect rect;
139 GetClientRect(&rect);
140 int x = (rect.Width() - cxIcon + 1) / 2;
141 int y = (rect.Height() - cyIcon + 1) / 2;
142
143 // Draw the icon
144 dc.DrawIcon(x, y, m_hIcon);
145 }
146 else
147 {
148 CDialog::OnPaint();
149 }
150 }
151
152 // The system calls this function to obtain the cursor to display while the user drags
153 // the minimized window.
154 HCURSOR Ch6udlnssystemDlg::OnQueryDragIcon()
155 {
156 return static_cast<HCURSOR>(m_hIcon);
157 }
158
159 void Ch6udlnssystemDlg::OnHelpAbout()
160 {
161 MessageBox("DA6H :: Udlånssystem\r\nLavet af:\r\nKevin, Hedin & Torben");
162 }

  ViewVC Help
Powered by ViewVC 1.1.20