📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace VCSharp
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.IContainer components;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem mnuOpen;
private System.Windows.Forms.MenuItem mnuSave;
private System.Windows.Forms.MenuItem mnuFile;
private System.Windows.Forms.MenuItem mnuDraw;
private System.Windows.Forms.MenuItem mnuLine;
private System.Windows.Forms.MenuItem mnuArc;
private System.Windows.Forms.MenuItem mnuText;
private System.Windows.Forms.MenuItem mnuEdit;
private System.Windows.Forms.MenuItem mnuSelect;
private System.Windows.Forms.MenuItem mnuSelAll;
private System.Windows.Forms.MenuItem mnuDesel;
private System.Windows.Forms.MenuItem mnuDelete;
private System.Windows.Forms.MenuItem mnuTrans;
private System.Windows.Forms.MenuItem mnuMove;
private System.Windows.Forms.MenuItem mnuRotate;
private System.Windows.Forms.MenuItem mnuMirror;
private System.Windows.Forms.MenuItem mnuHelp;
private System.Windows.Forms.MenuItem mnuAbout;
private ArrayList ges=new ArrayList();
private ArrayList geSels=new ArrayList();
private ICommand aCommand;
private CCreateLine creLine=new CCreateLine();
private CCreateRectangle creRect=new CCreateRectangle();
private CCreateCircle creCircle=new CCreateCircle();
private CCreateArc creArc=new CCreateArc();
private CCreateText creText=new CCreateText();
private CMove trMove=new CMove();
private CRotate trRotate=new CRotate();
private CMirror trMirror=new CMirror();
private CSelect sel=new CSelect();
private System.Windows.Forms.MenuItem mnuRect;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.ToolBar toolBar1;
private System.Windows.Forms.ToolBarButton btnOpen;
private System.Windows.Forms.ToolBarButton btnSave;
private System.Windows.Forms.ToolBarButton btnSelect;
private System.Windows.Forms.ToolBarButton btnDelete;
private System.Windows.Forms.ToolBarButton btnLine;
private System.Windows.Forms.ToolBarButton btnRectangle;
private System.Windows.Forms.ToolBarButton btnCircle;
private System.Windows.Forms.ToolBarButton btnArc;
private System.Windows.Forms.ToolBarButton btnText;
private System.Windows.Forms.ToolBarButton btnMove;
private System.Windows.Forms.ToolBarButton btnRotate;
private System.Windows.Forms.ToolBarButton btnMirror;
private System.Windows.Forms.ToolBarButton btnZoomIn;
private System.Windows.Forms.ToolBarButton btnZoomOut;
private System.Windows.Forms.ToolBarButton btnHelp;
private System.Windows.Forms.ToolBarButton toolBarButton16;
private System.Windows.Forms.ToolBarButton toolBarButton17;
private System.Windows.Forms.ToolBarButton toolBarButton1;
private System.Windows.Forms.ToolBarButton toolBarButton2;
private System.Windows.Forms.MenuItem mnuCircle;
private System.Windows.Forms.MenuItem mnuZoomIn;
private System.Windows.Forms.MenuItem mnuZoomOut;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private Module m=new Module();
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mnuFile = new System.Windows.Forms.MenuItem();
this.mnuOpen = new System.Windows.Forms.MenuItem();
this.mnuSave = new System.Windows.Forms.MenuItem();
this.mnuDraw = new System.Windows.Forms.MenuItem();
this.mnuLine = new System.Windows.Forms.MenuItem();
this.mnuRect = new System.Windows.Forms.MenuItem();
this.mnuCircle = new System.Windows.Forms.MenuItem();
this.mnuArc = new System.Windows.Forms.MenuItem();
this.mnuText = new System.Windows.Forms.MenuItem();
this.mnuEdit = new System.Windows.Forms.MenuItem();
this.mnuSelect = new System.Windows.Forms.MenuItem();
this.mnuSelAll = new System.Windows.Forms.MenuItem();
this.mnuDesel = new System.Windows.Forms.MenuItem();
this.mnuDelete = new System.Windows.Forms.MenuItem();
this.mnuTrans = new System.Windows.Forms.MenuItem();
this.mnuMove = new System.Windows.Forms.MenuItem();
this.mnuRotate = new System.Windows.Forms.MenuItem();
this.mnuMirror = new System.Windows.Forms.MenuItem();
this.mnuZoomIn = new System.Windows.Forms.MenuItem();
this.mnuZoomOut = new System.Windows.Forms.MenuItem();
this.mnuHelp = new System.Windows.Forms.MenuItem();
this.mnuAbout = new System.Windows.Forms.MenuItem();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.btnOpen = new System.Windows.Forms.ToolBarButton();
this.btnSave = new System.Windows.Forms.ToolBarButton();
this.toolBarButton16 = new System.Windows.Forms.ToolBarButton();
this.btnSelect = new System.Windows.Forms.ToolBarButton();
this.btnDelete = new System.Windows.Forms.ToolBarButton();
this.toolBarButton17 = new System.Windows.Forms.ToolBarButton();
this.btnLine = new System.Windows.Forms.ToolBarButton();
this.btnRectangle = new System.Windows.Forms.ToolBarButton();
this.btnCircle = new System.Windows.Forms.ToolBarButton();
this.btnArc = new System.Windows.Forms.ToolBarButton();
this.btnText = new System.Windows.Forms.ToolBarButton();
this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
this.btnMove = new System.Windows.Forms.ToolBarButton();
this.btnRotate = new System.Windows.Forms.ToolBarButton();
this.btnMirror = new System.Windows.Forms.ToolBarButton();
this.btnZoomIn = new System.Windows.Forms.ToolBarButton();
this.btnZoomOut = new System.Windows.Forms.ToolBarButton();
this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
this.btnHelp = new System.Windows.Forms.ToolBarButton();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuFile,
this.mnuDraw,
this.mnuEdit,
this.mnuTrans,
this.mnuHelp});
//
// mnuFile
//
this.mnuFile.Index = 0;
this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuOpen,
this.mnuSave});
this.mnuFile.Text = "文件";
//
// mnuOpen
//
this.mnuOpen.Index = 0;
this.mnuOpen.Text = "打开...";
this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);
//
// mnuSave
//
this.mnuSave.Index = 1;
this.mnuSave.Text = "保存";
this.mnuSave.Click += new System.EventHandler(this.mnuSave_Click);
//
// mnuDraw
//
this.mnuDraw.Index = 1;
this.mnuDraw.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuLine,
this.mnuRect,
this.mnuCircle,
this.mnuArc,
this.mnuText});
this.mnuDraw.Text = "绘图";
//
// mnuLine
//
this.mnuLine.Index = 0;
this.mnuLine.Text = "直线段";
this.mnuLine.Click += new System.EventHandler(this.mnuLine_Click);
//
// mnuRect
//
this.mnuRect.Index = 1;
this.mnuRect.Text = "矩形";
this.mnuRect.Click += new System.EventHandler(this.mnuRect_Click);
//
// mnuCircle
//
this.mnuCircle.Index = 2;
this.mnuCircle.Text = "圆";
this.mnuCircle.Click += new System.EventHandler(this.mnuCircle_Click);
//
// mnuArc
//
this.mnuArc.Index = 3;
this.mnuArc.Text = "圆弧";
this.mnuArc.Click += new System.EventHandler(this.mnuArc_Click);
//
// mnuText
//
this.mnuText.Index = 4;
this.mnuText.Text = "文本";
this.mnuText.Click += new System.EventHandler(this.mnuText_Click);
//
// mnuEdit
//
this.mnuEdit.Index = 2;
this.mnuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuSelect,
this.mnuSelAll,
this.mnuDesel,
this.mnuDelete});
this.mnuEdit.Text = "编辑";
//
// mnuSelect
//
this.mnuSelect.Index = 0;
this.mnuSelect.Text = "选择";
this.mnuSelect.Click += new System.EventHandler(this.mnuSelect_Click);
//
// mnuSelAll
//
this.mnuSelAll.Index = 1;
this.mnuSelAll.Text = "全选";
this.mnuSelAll.Click += new System.EventHandler(this.mnuSelAll_Click);
//
// mnuDesel
//
this.mnuDesel.Index = 2;
this.mnuDesel.Text = "放弃选择";
this.mnuDesel.Click += new System.EventHandler(this.mnuDesel_Click);
//
// mnuDelete
//
this.mnuDelete.Index = 3;
this.mnuDelete.Text = "删除";
this.mnuDelete.Click += new System.EventHandler(this.mnuDelete_Click);
//
// mnuTrans
//
this.mnuTrans.Index = 3;
this.mnuTrans.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuMove,
this.mnuRotate,
this.mnuMirror,
this.mnuZoomIn,
this.mnuZoomOut});
this.mnuTrans.Text = "变换";
//
// mnuMove
//
this.mnuMove.Index = 0;
this.mnuMove.Text = "平移";
this.mnuMove.Click += new System.EventHandler(this.mnuMove_Click);
//
// mnuRotate
//
this.mnuRotate.Index = 1;
this.mnuRotate.Text = "旋转";
this.mnuRotate.Click += new System.EventHandler(this.mnuRotate_Click);
//
// mnuMirror
//
this.mnuMirror.Index = 2;
this.mnuMirror.Text = "镜像";
this.mnuMirror.Click += new System.EventHandler(this.mnuMirror_Click);
//
// mnuZoomIn
//
this.mnuZoomIn.Index = 3;
this.mnuZoomIn.Text = "比例放大";
this.mnuZoomIn.Click += new System.EventHandler(this.mnuZoomIn_Click);
//
// mnuZoomOut
//
this.mnuZoomOut.Index = 4;
this.mnuZoomOut.Text = "比例缩小";
this.mnuZoomOut.Click += new System.EventHandler(this.mnuZoomOut_Click);
//
// mnuHelp
//
this.mnuHelp.Index = 4;
this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuAbout});
this.mnuHelp.Text = "帮助";
//
// mnuAbout
//
this.mnuAbout.Index = 0;
this.mnuAbout.Text = "关于";
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
//
// imageList1
//
this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// toolBar1
//
this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.btnOpen,
this.btnSave,
this.toolBarButton16,
this.btnSelect,
this.btnDelete,
this.toolBarButton17,
this.btnLine,
this.btnRectangle,
this.btnCircle,
this.btnArc,
this.btnText,
this.toolBarButton1,
this.btnMove,
this.btnRotate,
this.btnMirror,
this.btnZoomIn,
this.btnZoomOut,
this.toolBarButton2,
this.btnHelp});
this.toolBar1.DropDownArrows = true;
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(768, 25);
this.toolBar1.TabIndex = 0;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// btnOpen
//
this.btnOpen.ImageIndex = 0;
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -