📄 form1.h
字号:
#pragma once
#include "Elements.h"
#include "Sketch.h"
#include "PenDialog.h"
#include "TextDialog.h"
namespace CLRSketcher {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Runtime::Serialization::Formatters::Binary;
using namespace System::IO;
enum class ElementType {LINE, RECTANGLE, CIRCLE, CURVE, TEXT};
enum class Mode {Normal, Move};
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void): elementType(ElementType::LINE), color(Color::Black)
, drawing(false)
, firstPoint(0), sketch(gcnew Sketch()),
highlightedElement(nullptr), mode(Mode::Normal)
,penDialog(gcnew PenDialog())
, penWidth(1), textDialog(gcnew TextDialog())
,formatter(gcnew BinaryFormatter()), sketchFilepath(nullptr)
{
InitializeComponent();
//
//TODO: Add the constructor code here
penWidthComboBox->SelectedIndex = 0;
textFont = Font;
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::MenuStrip^ menuStrip1;
protected:
private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ newToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ openToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator;
private: System::Windows::Forms::ToolStripMenuItem^ saveToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ saveAsToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1;
private: System::Windows::Forms::ToolStripMenuItem^ printToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ printPreviewToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator2;
private: System::Windows::Forms::ToolStripMenuItem^ exitToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ editToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ undoToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ redoToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator3;
private: System::Windows::Forms::ToolStripMenuItem^ cutToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ copyToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ pasteToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator4;
private: System::Windows::Forms::ToolStripMenuItem^ selectAllToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ toolsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ customizeToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ optionsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ elementToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ lineToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ rectangleToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ circleToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ curveToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ helpToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ contentsToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ indexToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ searchToolStripMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator5;
private: System::Windows::Forms::ToolStripMenuItem^ aboutToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ colorToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ redToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ greenToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ blueToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ blackToolStripMenuItem;
private: System::Windows::Forms::ToolStrip^ toolStrip1;
private: System::Windows::Forms::ToolStripButton^ newToolStripButton;
private: System::Windows::Forms::ToolStripButton^ openToolStripButton;
private: System::Windows::Forms::ToolStripButton^ saveToolStripButton;
private: System::Windows::Forms::ToolStripButton^ printToolStripButton;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator6;
private: System::Windows::Forms::ToolStripButton^ toolStripLineButton;
private: System::Windows::Forms::ToolStripButton^ rectangleToolStripButton;
private: System::Windows::Forms::ToolStripButton^ circleToolStripButton;
private: System::Windows::Forms::ToolStripButton^ curveToolStripButton;
private: System::Windows::Forms::ToolStripButton^ blackToolStripButton;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator8;
private: System::Windows::Forms::ToolStripButton^ redToolStripButton;
private: System::Windows::Forms::ToolStripButton^ greenToolStripButton;
private: System::Windows::Forms::ToolStripButton^ blueToolStripButton;
private: System::Windows::Forms::ContextMenuStrip^ contextMenuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ moveContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ sendToBackContextMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ contextSeparator;
private: System::Windows::Forms::ToolStripMenuItem^ lineContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ rectangleContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ circleContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ curveContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ blackContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ redContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ greenContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ blueContextMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ deleteContextMenuItem;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator9;
private: System::Windows::Forms::ToolStripButton^ penWidthButton;
private: System::Windows::Forms::ToolStripComboBox^ penWidthComboBox;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator10;
private: System::Windows::Forms::ToolStripMenuItem^ textToolStripMenuItem;
private: System::Windows::Forms::ToolStripButton^ textToolStripButton;
private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator7;
private: System::Windows::Forms::ToolStripButton^ fontToolStripButton;
private: System::Windows::Forms::FontDialog^ fontDialog1;
private: System::Windows::Forms::ToolStripMenuItem^ textContextMenuItem;
private: System::Windows::Forms::OpenFileDialog^ openFileDialog;
private: System::Windows::Forms::SaveFileDialog^ saveFileDialog;
private: System::Drawing::Printing::PrintDocument^ printDocument;
private: System::Windows::Forms::PrintDialog^ printDialog;
private: System::ComponentModel::IContainer^ components;
private:
/// <summary>
/// Required designer variable.
/// </summary>
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->newToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStripSeparator = (gcnew System::Windows::Forms::ToolStripSeparator());
this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->saveAsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->printToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->printPreviewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->editToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->undoToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->redoToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->cutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->copyToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->pasteToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->selectAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->customizeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->optionsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->elementToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->lineToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->rectangleToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->circleToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->curveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->textToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->colorToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->blackToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->redToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->greenToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->blueToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->contentsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->indexToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->searchToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
this->newToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->openToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->saveToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->printToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->toolStripLineButton = (gcnew System::Windows::Forms::ToolStripButton());
this->rectangleToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -