canvas.h
来自「一个使用Windows SDK编写的简单画板程序。实现点、线、矩形、椭圆、文字。」· C头文件 代码 · 共 88 行
H
88 行
#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 + =
减小字号Ctrl + -
显示快捷键?