#define EX 1
#define OH 2class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};class CMainWindow : public CWnd
{
protected:
static const CRect m_rcSquares[9];
int m_nGameGrid[9];
int m_nNextChar;
int GetRectID(CPoint point);
void DrawBoard(CDC * pDC);
void DrawX(CDC * pDC, int nPos);
void DrawO(CDC * pDC, int nPos);
void ResetGame();
void CheckForGameOver();
int IsWinner();
BOOL IsDraw();
public:
CMainWindow();
protected:
virtual void PostNcDestroy(); afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags,CPoint point); DECLARE_MESSAGE_MAP()
};#include<afxwin.h>
#include"TicTac.h"
CMyApp myApp;BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}BEGIN_MESSAGE_MAP(CMainWindow,CWnd)
/* ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
ON_WM_RBUTTONDOWN()*/
END_MESSAGE_MAP()const CRect CMainWindow::m_rcSquares [9]=
{
CRect(16,16,122,122),
CRect(128,16,224,112),
CRect(240,16,336,112),
CRect(16,128,112,224),
CRect(128,128,224,224),
CRect(240,128,336,224),
CRect(16,240,112,336),
CRect(128,240,224,336),
CRect(240,240,336,336),
};CMainWindow::CMainWindow ()
{
m_nNextChar = EX;
::ZeroMemory (m_nGameGrid,9 * sizeof(int) ); //
//Register a WNDCLASS.
//
CString strWndClass = AfxRegisterWndClass
(
CS_DBLCLKS, //Class style
AfxGetApp()->LoadStandardCursor (IDC_ARROW), //class cursou
(HBRUSH) (COLOR_3DFACE + 1 ), //background brush
AfxGetApp()->LoadStandardIcon (IDI_WINLOGO) //class icon
); //
//Create a window
//
CreateEx(0,strWndClass,_T("Tic-Tac-Toe"),
WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL); //
//size the window
//
CRect rect(0,0,352,352);
CalcWindowRect(&rect); //有没有这句,没看出来效果不同
SetWindowPos(NULL,0,0,rect.Width (), rect.Height (), SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW);
}void CMainWindow::PostNcDestroy ()
{
delete this;
}CalcWindowRect 是什么作用。不要让我去看百度和MSDN了。昨天看了一天都没看懂。我来找个明白人问问
#define OH 2class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};class CMainWindow : public CWnd
{
protected:
static const CRect m_rcSquares[9];
int m_nGameGrid[9];
int m_nNextChar;
int GetRectID(CPoint point);
void DrawBoard(CDC * pDC);
void DrawX(CDC * pDC, int nPos);
void DrawO(CDC * pDC, int nPos);
void ResetGame();
void CheckForGameOver();
int IsWinner();
BOOL IsDraw();
public:
CMainWindow();
protected:
virtual void PostNcDestroy(); afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags,CPoint point); DECLARE_MESSAGE_MAP()
};#include<afxwin.h>
#include"TicTac.h"
CMyApp myApp;BOOL CMyApp::InitInstance ()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
return TRUE;
}BEGIN_MESSAGE_MAP(CMainWindow,CWnd)
/* ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
ON_WM_RBUTTONDOWN()*/
END_MESSAGE_MAP()const CRect CMainWindow::m_rcSquares [9]=
{
CRect(16,16,122,122),
CRect(128,16,224,112),
CRect(240,16,336,112),
CRect(16,128,112,224),
CRect(128,128,224,224),
CRect(240,128,336,224),
CRect(16,240,112,336),
CRect(128,240,224,336),
CRect(240,240,336,336),
};CMainWindow::CMainWindow ()
{
m_nNextChar = EX;
::ZeroMemory (m_nGameGrid,9 * sizeof(int) ); //
//Register a WNDCLASS.
//
CString strWndClass = AfxRegisterWndClass
(
CS_DBLCLKS, //Class style
AfxGetApp()->LoadStandardCursor (IDC_ARROW), //class cursou
(HBRUSH) (COLOR_3DFACE + 1 ), //background brush
AfxGetApp()->LoadStandardIcon (IDI_WINLOGO) //class icon
); //
//Create a window
//
CreateEx(0,strWndClass,_T("Tic-Tac-Toe"),
WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL); //
//size the window
//
CRect rect(0,0,352,352);
CalcWindowRect(&rect); //有没有这句,没看出来效果不同
SetWindowPos(NULL,0,0,rect.Width (), rect.Height (), SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW);
}void CMainWindow::PostNcDestroy ()
{
delete this;
}CalcWindowRect 是什么作用。不要让我去看百度和MSDN了。昨天看了一天都没看懂。我来找个明白人问问
解决方案 »
- 将控件的信息存储到access出现bug
- 求教:vc6怎么用dialog控制底层view上的绘图刷新?
- 关于界面
- 100分请教,directx 3d中如何同时载入两个.x文件,让两个物体并排显示?
- =::是啥意思?
- 问高手们一个非常奇怪的加载DLL文件的现象,不解!
- 急求 数据结构 教学算法 演示 源码
- 求小号多开原理
- CFont与LOGFont、HFont是什么关系,如何建立联系?
- 有谁安装过MICROSOFT Certificate Server 做activex控件的认证服务器
- ipv4与ipv6编程时有什么区别
- 什么时候必须用Unicode字符串? MBCS难道不能完成多语言字符的任务吗?
---------------------------------------------------
呵呵,你可以去google看看
http://blog.csdn.net/joimson/archive/2009/04/28/4133182.aspx
当你实现异形窗口时必须重载,以提供正确的尺寸计算