📄 form1.h
字号:
#pragma once
#include "Elements.h"
#include "Sketch.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::IO;
enum class ElementType {LINE, RECTANGLE, CIRCLE, CURVE};
enum class Mode {Normal, Move, Rotate};
/// <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)
{
FileStream^ fs = gcnew FileStream(L"TraceIt.txt", FileMode::Create);
StreamWriter^ sw = gcnew StreamWriter(fs);
sw->AutoFlush = true;
Console::SetOut( sw);
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
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::ToolStripSeparator^ toolStripSeparator7;
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::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->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->toolStripSeparator7 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->toolStripLineButton = (gcnew System::Windows::Forms::ToolStripButton());
this->rectangleToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->circleToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->curveToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->toolStripSeparator8 = (gcnew System::Windows::Forms::ToolStripSeparator());
this->blackToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->redToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->greenToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->blueToolStripButton = (gcnew System::Windows::Forms::ToolStripButton());
this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
this->moveContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->deleteContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->sendToBackContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->contextSeparator = (gcnew System::Windows::Forms::ToolStripSeparator());
this->lineContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->rectangleContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->circleContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->curveContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->blackContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->redContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->greenContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->blueContextMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->menuStrip1->SuspendLayout();
this->toolStrip1->SuspendLayout();
this->contextMenuStrip1->SuspendLayout();
this->SuspendLayout();
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(6) {this->fileToolStripMenuItem,
this->editToolStripMenuItem, this->toolsToolStripMenuItem, this->elementToolStripMenuItem, this->colorToolStripMenuItem, this->helpToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(355, 24);
this->menuStrip1->TabIndex = 0;
this->menuStrip1->Text = L"menuStrip1";
//
// fileToolStripMenuItem
//
this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(10) {this->newToolStripMenuItem,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -