|
// AboutDlg.cpp : implementation file
//
#include "stdafx.h"
#include "VisualCalc.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// Default constructor
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDI_ABOUT);
}
// Constructor
CAboutDlg::CAboutDlg(CString strGUIVersion, CString strParserVersion)
: CDialog(CAboutDlg::IDD),
m_strGUIVersion(strGUIVersion),
m_strParserVersion(strParserVersion) {
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDI_ABOUT);
}
// For exchanges between controls and data members
void CAboutDlg::DoDataExchange(CDataExchange* pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_WM_RBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// Draws the icon of the dialog
void CAboutDlg::OnPaint() {
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
dc.DrawIcon(x, y, m_hIcon);
}
// Initializes the About DialogBox
BOOL CAboutDlg::OnInitDialog() {
CDialog::OnInitDialog();
CString strTemp;
strTemp = "About VisualCalc ";
strTemp += m_strGUIVersion;
this->SetWindowText(strTemp);
strTemp = "VisualCalc version ";
strTemp += m_strGUIVersion;
((CStatic*)GetDlgItem(IDC_VERSION_STATIC))->SetWindowText(strTemp);
strTemp = "using Parser v";
strTemp += m_strParserVersion;
((CStatic*)GetDlgItem(IDC_PARSERVERSION_STATIC))->SetWindowText(strTemp);
return TRUE;
}
// Closes the About DialogBox on right-click
void CAboutDlg::OnRButtonUp(UINT nFlags, CPoint point) {
this->EndDialog(0);
CDialog::OnRButtonUp(nFlags, point);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.