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

📄 canvas.h

📁 一个使用Windows SDK编写的简单画板程序。实现点、线、矩形、椭圆、文字。
💻 H
字号:
#include<windows.h>
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<math.h>
#include <commdlg.h>
using namespace std;

typedef struct Shape_point 
{
	int start_x;
	int start_y;
	int end_x;
	int end_y;
}SHAPE_POINT,*pSHAPE_POINT;

typedef struct Input_Text
{
	int x;
	int y;
	string sText;
//	string chFont;
	int IFont;
}TEXT,*pTEXT;


class Canvas
{
public:
	Canvas();

	int GetMode();
	bool SetMode(int x);
	
	int GetState();
	bool SetState(int x);
	
	int GetFont();
	bool SetFont(int x);

	int GetChoose_Mode();

	bool Start_line(int x,int y);
	bool Move_line(HWND hWnd,int x,int y);
	bool Draw_line(HWND hWnd, int x,int y);

    bool Start_rect(int x,int y);
	bool Move_rect(HWND hWnd, int x,int y);
	bool Draw_rect(HWND hWnd, int x,int y);

	bool Start_ellipse(int x, int y);
	bool Move_ellipse(HWND hWnd, int x, int y);
	bool Draw_ellipse(HWND hWnd, int x, int y);


	bool Input_text(HWND hWnd, int x,int y, char pText[256]);

	bool Choose(HWND hWnd,int x,int y);
	bool Choose_text(HWND hWnd);
	bool Draw(HWND hWnd);

	bool SaveAsToDisk(HWND hWnd);
	bool SaveToDisk(HWND hWnd);
	bool LoadFromDisk(HWND hWnd);

	bool Delete(HWND hWnd);
	
    
private:
	int iMode;
	int iState;
	int Choose_Mode;
	int Choose_ID;
	int IntFont;
	bool fSave;
	string strFileName;
	POINT temp;
	SHAPE_POINT iRect;
	SHAPE_POINT iLine;
	SHAPE_POINT iEllipse;
	
	vector<SHAPE_POINT> vec_line;
	vector<SHAPE_POINT> vec_rect;
	vector<SHAPE_POINT> vec_ellipse;
	vector<TEXT> vec_text;
	vector<string> vec_font;
};

⌨️ 快捷键说明

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