NameDlg.cpp
上传用户:clj987822
上传日期:2022-04-25
资源大小:13296k
文件大小:2k
- // NameDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "RussianGame.h"
- #include "NameDlg.h"
- #include "HeroDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CNameDlg dialog
- CNameDlg::CNameDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CNameDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CNameDlg)
- m_HeroName = _T("");
- //}}AFX_DATA_INIT
- }
- void CNameDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CNameDlg)
- DDX_Control(pDX, IDHERO, m_Hero);
- DDX_Control(pDX, IDOK, m_OK);
- DDX_Text(pDX, IDC_EDITNAME, m_HeroName);
- DDV_MaxChars(pDX, m_HeroName, 20);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CNameDlg, CDialog)
- //{{AFX_MSG_MAP(CNameDlg)
- ON_BN_CLICKED(IDHERO, OnHero)
- ON_WM_PAINT()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CNameDlg message handlers
- BOOL CNameDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- //m_OK.SetFlat(FALSE);
- // m_OK.SetInactiveBgColor(RGB(123,68,200));
- m_OK.SetIcon(IDI_ICONOK);
- m_OK.AddToolTip(_T("确定"));
- m_OK.SetBtnCursor(IDC_HAND);
- m_OK.SetActiveFgColor(RGB(0,0,255));
- // m_Hero.SetFlat(FALSE);
- // m_Hero.SetInactiveBgColor(RGB(123,68,200));
- m_Hero.SetIcon(IDI_ICONHERO);
- m_Hero.AddToolTip(_T("英雄榜"));
- m_Hero.SetBtnCursor(IDC_HAND);
- m_Hero.SetActiveFgColor(RGB(0,0,255));
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CNameDlg::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData(TRUE);
- if(m_HeroName.IsEmpty())
- m_HeroName="无名英雄";
- AfxGetApp()->WriteProfileString(_T("英雄榜"),_T("heroname"),m_HeroName);
- CDialog::OnOK();
- }
- void CNameDlg::OnHero()
- {
- // TODO: Add your control notification handler code here
- CHeroDlg hero;
- hero.DoModal();
- }
- void CNameDlg::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- //CDC memdc;
- // memdc.CreateCompatibleDC(&dc);
- // RECT rect;
- // GetClientRect(&rect);
- // CBitmap bitmap;
- // bitmap.LoadBitmap(IDB_NAME);
- // memdc.SelectObject(bitmap);
- // dc.BitBlt(0,0,rect.right-rect.left ,rect.bottom -rect.top ,&memdc,0,0,SRCCOPY);
- // Do not call CDialog::OnPaint() for painting messages
- }