?? dlgdefgame.cpp
字號:
// DlgDefGame.cpp : implementation file
//
#include "stdafx.h"
#include "JL.h"
#include "JLDoc.h"
#include "DlgDefGame.h"
#include "DGView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CJLDoc * AfxGetDocument();
extern CJLView * AfxGetView();
/////////////////////////////////////////////////////////////////////////////
// CDlgDefGame dialog
CDlgDefGame::CDlgDefGame(CWnd* pParent /*=NULL*/)
: CDialog(CDlgDefGame::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgDefGame)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
//在客戶區創建一個窗口用于編輯牌局,所有的編輯功能都由此窗口完成
m_pDGWnd = new CDGWnd;
}
//刪除窗口
CDlgDefGame::~CDlgDefGame()
{
delete m_pDGWnd;
}
void CDlgDefGame::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgDefGame)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgDefGame, CDialog)
//{{AFX_MSG_MAP(CDlgDefGame)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_SIZING()
ON_COMMAND(IDM_SAVE_DEF, OnSaveDef)
ON_COMMAND(IDM_LOAD_DEF, OnLoadDef)
ON_WM_CLOSE()
ON_COMMAND(IDM_SAVE_DEF_AS, OnSaveDefAs)
ON_COMMAND(IDM_NEW_DEF, OnNewDef)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgDefGame message handlers
int CDlgDefGame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
//創建一個窗口占據整個客戶區
CRect r;
GetClientRect(r);
m_pDGWnd->Create(NULL,NULL,WS_CHILD|WS_VISIBLE,r,this,210);
return 0;
}
void CDlgDefGame::OnSetFocus(CWnd* pOldWnd)
{
CDialog::OnSetFocus(pOldWnd);
// TODO: Add your message handler code here
m_pDGWnd->SetFocus();
}
void CDlgDefGame::OnSizing(UINT fwSide, LPRECT pRect)
{
CDialog::OnSizing(fwSide, pRect);
// TODO: Add your message handler code here
CRect r;
GetClientRect(r);
m_pDGWnd->MoveWindow(r);
}
//調整對話框大小和主程序窗口一樣大,讓編輯牌局的窗口占據對話框的整個客戶區
BOOL CDlgDefGame::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CRect r;
CWnd *pParent = GetParent();
pParent->GetWindowRect(r);
MoveWindow(r);
GetClientRect(r);
m_pDGWnd->MoveWindow(r);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgDefGame::OnSaveDef()
{
m_pDGWnd->SaveDefGame();
}
void CDlgDefGame::OnLoadDef()
{
m_pDGWnd->LoadDefGame();
}
void CDlgDefGame::OnSaveDefAs()
{
m_pDGWnd->SaveDefGameAs();
}
void CDlgDefGame::OnClose()
{
// TODO: Add your message handler code here and/or call default
if(!m_pDGWnd->GiveUp()) return;
CDialog::OnClose();
}
void CDlgDefGame::OnNewDef()
{
m_pDGWnd->NewDefGame();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -