www.gusucode.com > 一个VC++ GUI测试程序-源码程序 > 一个VC++ GUI测试程序-源码程序/code/Test3Dlg.cpp

    //Download by http://www.NewXing.com
// Test3Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "guitest.h"
#include "Test3Dlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTest3Dlg dialog


CTest3Dlg::CTest3Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTest3Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTest3Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CTest3Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTest3Dlg)
	DDX_Control(pDX, IDC_BUTTON3, m_btnskin);
	DDX_Control(pDX, IDC_BUTTON2, m_btn2);
	DDX_Control(pDX, IDC_BUTTON1, m_btn1);
	DDX_Control(pDX, IDC_DYNALINE_STATIC, m_DynLine);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTest3Dlg, CDialog)
	//{{AFX_MSG_MAP(CTest3Dlg)
	ON_WM_PAINT()
	ON_WM_ERASEBKGND()
	ON_BN_CLICKED(IDC_START, OnStart)
	ON_BN_CLICKED(IDC_STOP, OnStop)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTest3Dlg message handlers

void CTest3Dlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CRect rc;
	GetClientRect(&rc);
	bmp.DrawTranCenter(dc,&rc,RGB(250,244,228));	
}

BOOL CTest3Dlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	bmp.LoadFromFile("1.bmp");

	m_btn1.SetFont("Times New Roman",0,0,1,1);
	m_btn1.SetShade(SHS_VBUMP,8,20,5,RGB(55,55,255));

	m_btn2.SetFont("Tahoma",16);
	m_btn2.SetShade(SHS_DIAGSHADE,8,10,5,RGB(55,255,55));
	m_btn2.SetTextColor(RGB(0,99,0));

	m_btnskin.SetTextColor(RGB(255,0,0));
	m_btnskin.SetToolTipText("Button1");
	m_btnskin.SetSkin(IDB_B1NORM,IDB_B1DOWN,IDB_B1OVER,IDB_B1GRAY,0,IDB_B1MASK,0,0,0);
	
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CTest3Dlg::OnEraseBkgnd(CDC* pDC) 
{
	return TRUE;
}

void CTest3Dlg::OnStart() 
{
	m_DynLine.Start();
}

void CTest3Dlg::OnStop() 
{
	m_DynLine.Stop();	
}