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

Contents of /h6-udlånssystemDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20