⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canvas.cpp

📁 Windows 图形编程 书籍
💻 CPP
字号:
//-----------------------------------------------------------------------------------//
//              Windows Graphics Programming: Win32 GDI and DirectDraw               //
//                             ISBN  0-13-086985-6                                   //
//                                                                                   //
//  Written            by  Yuan, Feng                             www.fengyuan.com   //
//  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
//  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
//                                                                                   //
//  FileName   : canvas.cpp						                                     //
//  Description: Generic simple child window class                                   //
//  Version    : 1.00.000, May 31, 2000                                              //
//-----------------------------------------------------------------------------------//

#define STRICT
#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#include <assert.h>

#include "win.h"
#include "Canvas.h"


KCanvas::KCanvas()
{
}


KCanvas::~KCanvas()
{
}


void KCanvas::OnDraw(HDC hDC, const RECT * rcPaint)
{
//	Rectangle(hDC, 0, 0, 100, 100);
}


// called by CFrame::OnCommand
BOOL KCanvas::OnCommand(WPARAM wParam, LPARAM lParam)
{
	return FALSE;	// not processed
}


LRESULT KCanvas::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch( uMsg )
	{
		case WM_CREATE:
			m_hWnd = hWnd;

			return 0;

		case WM_PAINT:
			{
				PAINTSTRUCT ps; 

				HDC hDC = BeginPaint(m_hWnd, &ps);

				OnDraw(hDC, & ps.rcPaint);

				EndPaint(m_hWnd, &ps);
			}
			return 0;

		case WM_COMMAND:
			if ( OnCommand(wParam, lParam) )
				return 0;
	}

	return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -