// DCFrameWnd.cpp : implementation file
//
#include "stdafx.h"
#include "res.h"
#include "DCFrameWnd.h"
#include "DCDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//==========================================================================
//全局量
/////////////////////////////////////////////////////////////////////////////
// DCFrameWnd
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(DCFrameWnd, CFrameWnd)
DCFrameWnd::DCFrameWnd()
{
RECT rect;
Create(NULL,"邓海燕20026407");
CClientDC dc(this);
int width = dc.GetDeviceCaps (HORZRES);
int height = dc.GetDeviceCaps (VERTRES);
GetWindowRect(&rect);
width=(width-(rect.right -rect.left ))/2;
height=(height-(rect.bottom -rect.top ))/2;
MoveWindow(width,height,600,500,true);
GetClientRect(&rect);
MainWidth=rect.right - rect.left;
MainHeight=rect.bottom - rect.top;
}
//----------------------------------------------------------------------------
DCFrameWnd::~DCFrameWnd()
{
}
//////////////////////////////////////////////////////////////////////////////
//消息映射
//////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(DCFrameWnd, CFrameWnd)
//{{AFX_MSG_MAP(DCFrameWnd)
ON_WM_LBUTTONDOWN()
ON_WM_KEYDOWN()
ON_WM_PAINT()
ON_COMMAND(ID_MENUITEM3, OnMenuitem3)
ON_COMMAND(ID_MENUITEM4, OnMenuitem4)
ON_COMMAND(ID_MENUITEM5, OnMenuitem5)
ON_COMMAND(ID_MENUITEM6, OnMenuitem6)
ON_COMMAND(ID_MENUITEM7, OnMenuitem7)
ON_COMMAND(ID_MENUITEM8, OnMenuitem8)
ON_COMMAND(ID_MABOUT, OnMabout)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DCFrameWnd message handlers
void DCFrameWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
long x;
x=MainWidth/3;
if(point.x<x)
MainTest.Test (0);
if(x<point.x&&point.x<(2*x))
MainTest.Test (1);
if((2*x)<point.x)
MainTest.Test (2);
// TODO: Add your message handler code here and/or call default
CFrameWnd::OnLButtonDown(nFlags, point);
}
//=====================================================================
void DCFrameWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar==VK_F1)
MainTest.Test (0);
if(nChar==VK_F2)
MainTest.Test (1);
if(nChar==VK_F3)
MainTest.Test (2);
if(nChar==VK_F4)
{
MainTest.ReStart(2);
MainTest.Draw();
}// TODO: Add your message handler code here and/or call default
CFrameWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
//======================================================================
void DCFrameWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting
MainTest.Draw();
// TODO: Add your message handler code here
// Do not call CFrameWnd::OnPaint() for painting messages
}
void DCFrameWnd::OnMenuitem3()
{
MainTest.ReStart(3);
MainTest.Draw();// TODO: Add your command handler code here
}
void DCFrameWnd::OnMenuitem4()
{
MainTest.ReStart(4);
MainTest.Draw();// TODO: Add your command handler code here
}
void DCFrameWnd::OnMenuitem5()
{
MainTest.ReStart(5);
MainTest.Draw();// TODO: Add your command handler code here
}
void DCFrameWnd::OnMenuitem6()
{
MainTest.ReStart(6);
MainTest.Draw();// TODO: Add your command handler code here
}
void DCFrameWnd::OnMenuitem7()
{
MainTest.ReStart(7);
MainTest.Draw();// TODO: Add your command handler code here
}
void DCFrameWnd::OnMenuitem8()
{
MainTest.ReStart(8);
MainTest.Draw();// TODO: Add your command handler code here
}
void DCFrameWnd::OnMabout()
{
DCDialog About;
About.DoModal();
}