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

📄 example.cs

📁 画图程序
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace GraphicalCS
{
	/// <summary>
	/// Beziers 的摘要说明。
	/// </summary>
	public class Example : System.Windows.Forms.Form
	{
		private System.Windows.Forms.PictureBox BeziersBox;
		private MousePoint newPoint;
		private System.Windows.Forms.MainMenu beziersMenu;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.ContextMenu contextMenu;
		private System.Windows.Forms.MenuItem Line;
		private System.Windows.Forms.MenuItem Rectangle;
		private System.Windows.Forms.MenuItem Bezier;
		private System.Windows.Forms.MenuItem sp;
		private System.Windows.Forms.MenuItem Exit;
		private System.Windows.Forms.MenuItem Style;
		private System.Windows.Forms.MenuItem Change;
		private System.Windows.Forms.MenuItem Finish;
		private System.Windows.Forms.MenuItem Clear;
		private MainWindow.ImageType newType;
		private System.Windows.Forms.MenuItem AddPoint;
		private System.Windows.Forms.MenuItem Dash;
		private System.Windows.Forms.MenuItem DashDot;
		private System.Windows.Forms.MenuItem DashDotDot;
		private System.Windows.Forms.MenuItem Dot;
		private System.Windows.Forms.MenuItem Solid;
		private System.Windows.Forms.MenuItem FiveStar;
		private System.Windows.Forms.MenuItem LineCap;
		private System.Drawing.Drawing2D.LineCap scap;
		private System.Drawing.Drawing2D.LineCap ecap;
		private System.Windows.Forms.MenuItem PrintScreen;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Example()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.BeziersBox = new System.Windows.Forms.PictureBox();
			this.contextMenu = new System.Windows.Forms.ContextMenu();
			this.Style = new System.Windows.Forms.MenuItem();
			this.Dash = new System.Windows.Forms.MenuItem();
			this.DashDot = new System.Windows.Forms.MenuItem();
			this.DashDotDot = new System.Windows.Forms.MenuItem();
			this.Dot = new System.Windows.Forms.MenuItem();
			this.Solid = new System.Windows.Forms.MenuItem();
			this.LineCap = new System.Windows.Forms.MenuItem();
			this.Change = new System.Windows.Forms.MenuItem();
			this.Finish = new System.Windows.Forms.MenuItem();
			this.AddPoint = new System.Windows.Forms.MenuItem();
			this.Clear = new System.Windows.Forms.MenuItem();
			this.PrintScreen = new System.Windows.Forms.MenuItem();
			this.beziersMenu = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.Line = new System.Windows.Forms.MenuItem();
			this.Rectangle = new System.Windows.Forms.MenuItem();
			this.FiveStar = new System.Windows.Forms.MenuItem();
			this.Bezier = new System.Windows.Forms.MenuItem();
			this.sp = new System.Windows.Forms.MenuItem();
			this.Exit = new System.Windows.Forms.MenuItem();
			this.SuspendLayout();
			// 
			// BeziersBox
			// 
			this.BeziersBox.BackColor = System.Drawing.SystemColors.ControlLightLight;
			this.BeziersBox.ContextMenu = this.contextMenu;
			this.BeziersBox.Dock = System.Windows.Forms.DockStyle.Fill;
			this.BeziersBox.Location = new System.Drawing.Point(0, 0);
			this.BeziersBox.Name = "BeziersBox";
			this.BeziersBox.Size = new System.Drawing.Size(640, 302);
			this.BeziersBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
			this.BeziersBox.TabIndex = 0;
			this.BeziersBox.TabStop = false;
			this.BeziersBox.Paint += new System.Windows.Forms.PaintEventHandler(this.BeziersBox_Paint);
			this.BeziersBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.BeziersBox_MouseUp);
			this.BeziersBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BeziersBox_MouseMove);
			this.BeziersBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.BeziersBox_MouseDown);
			// 
			// contextMenu
			// 
			this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						this.Style,
																						this.Change,
																						this.Finish,
																						this.AddPoint,
																						this.Clear,
																						this.PrintScreen});
			// 
			// Style
			// 
			this.Style.Index = 0;
			this.Style.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																				  this.Dash,
																				  this.DashDot,
																				  this.DashDotDot,
																				  this.Dot,
																				  this.Solid,
																				  this.LineCap});
			this.Style.Text = "Line &Style";
			// 
			// Dash
			// 
			this.Dash.Index = 0;
			this.Dash.Text = "&Dash";
			this.Dash.Click += new System.EventHandler(this.Dash_Click);
			// 
			// DashDot
			// 
			this.DashDot.Index = 1;
			this.DashDot.Text = "DashDo&t";
			this.DashDot.Click += new System.EventHandler(this.DashDot_Click);
			// 
			// DashDotDot
			// 
			this.DashDotDot.Index = 2;
			this.DashDotDot.Text = "DashD&otDot";
			this.DashDotDot.Click += new System.EventHandler(this.DashDotDot_Click);
			// 
			// Dot
			// 
			this.Dot.Index = 3;
			this.Dot.Text = "Dot";
			this.Dot.Click += new System.EventHandler(this.Dot_Click);
			// 
			// Solid
			// 
			this.Solid.Index = 4;
			this.Solid.Text = "&Solid";
			this.Solid.Click += new System.EventHandler(this.Solid_Click);
			// 
			// LineCap
			// 
			this.LineCap.Index = 5;
			this.LineCap.Text = "&LineCap";
			this.LineCap.Click += new System.EventHandler(this.LineCap_Click);
			// 
			// Change
			// 
			this.Change.Index = 1;
			this.Change.Text = "&Change";
			this.Change.Click += new System.EventHandler(this.Change_Click);
			// 
			// Finish
			// 
			this.Finish.Index = 2;
			this.Finish.Text = "&Finish";
			this.Finish.Click += new System.EventHandler(this.Finish_Click);
			// 
			// AddPoint
			// 
			this.AddPoint.Index = 3;
			this.AddPoint.Text = "&Add";
			this.AddPoint.Click += new System.EventHandler(this.AddPoint_Click);
			// 
			// Clear
			// 
			this.Clear.Index = 4;
			this.Clear.Text = "&Clear";
			this.Clear.Click += new System.EventHandler(this.Clear_Click);
			// 
			// PrintScreen
			// 
			this.PrintScreen.Index = 5;
			this.PrintScreen.Text = "&PrintScreen";
			this.PrintScreen.Click += new System.EventHandler(this.PrintScreen_Click);
			// 
			// beziersMenu
			// 
			this.beziersMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						this.menuItem1});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.Line,
																					  this.Rectangle,
																					  this.FiveStar,
																					  this.Bezier,
																					  this.sp,
																					  this.Exit});
			this.menuItem1.Text = "&Function";
			// 
			// Line
			// 
			this.Line.Index = 0;
			this.Line.Text = "&Line";
			this.Line.Click += new System.EventHandler(this.Line_Click);
			// 
			// Rectangle
			// 
			this.Rectangle.Index = 1;
			this.Rectangle.Text = "&Rectangle";
			this.Rectangle.Click += new System.EventHandler(this.Rectangle_Click);
			// 
			// FiveStar
			// 
			this.FiveStar.Index = 2;
			this.FiveStar.Text = "&FiveStar";
			this.FiveStar.Click += new System.EventHandler(this.FiveStar_Click);
			// 
			// Bezier
			// 
			this.Bezier.Index = 3;
			this.Bezier.Text = "&Beziers";
			this.Bezier.Click += new System.EventHandler(this.Bezier_Click);
			// 
			// sp
			// 
			this.sp.Index = 4;
			this.sp.Text = "-";
			// 
			// Exit
			// 
			this.Exit.Index = 5;
			this.Exit.Text = "&Exit";
			this.Exit.Click += new System.EventHandler(this.Exit_Click);
			// 
			// Example
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(640, 302);
			this.Controls.Add(this.BeziersBox);
			this.Menu = this.beziersMenu;
			this.Name = "Example";
			this.Text = "Example";
			this.ResumeLayout(false);

		}
		#endregion
		#region Beziers
		DShapeList beziersList = new DShapeList();
		DShapeList pointList = new DShapeList();
		PointCollection tpointCollection = new PointCollection();
		PointCollection pointCollection = new PointCollection();
		NewRegion regionCollection = new NewRegion();
		int beziersPoint;
		int BezierIndex;
		Number pointNumber = new Number();
		Number pointSum = new Number();
		bool pointChange = false;
		#endregion
		DashStyle style;
		Pen stylePen = new Pen(Color.DarkRed);
		DShapeList drawingList = new DShapeList();
		Point[] star = new Point[10];
		int starCount = 0;

⌨️ 快捷键说明

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