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

📄 positionform.cs

📁 一个通用的数据库访问层
💻 CS
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;namespace YariSoft.AgentMovieEditor.Modals{	public class PositionForm : BaseEditForm	{
		private System.Windows.Forms.Label editLabel;
		private System.Windows.Forms.NumericUpDown XPos;
		private System.Windows.Forms.NumericUpDown YPos;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;		private System.ComponentModel.IContainer components = null;		#region Properties
		public override object Value
		{
			get{ return new Point( ((Point)this._value).X, ((Point)this._value).Y ); }
			set{ 
				this._value = new Point( ((Point)value).X, ((Point)value).Y ); 
				this.XPos.Value = ((Point)value).X;
				this.YPos.Value = ((Point)value).Y;
			}
		}
		#endregion		public PositionForm()		{			// This call is required by the Windows Form Designer.			InitializeComponent();			// TODO: Add any initialization after the InitializeComponent call		}		/// <summary>		/// Clean up any resources being used.		/// </summary>		protected override void Dispose( bool disposing )		{			if( disposing )			{				if (components != null) 				{					components.Dispose();				}			}			base.Dispose( disposing );		}		#region Designer generated code		/// <summary>		/// Required method for Designer support - do not modify		/// the contents of this method with the code editor.		/// </summary>		private void InitializeComponent()		{			this.XPos = new System.Windows.Forms.NumericUpDown();
			this.YPos = new System.Windows.Forms.NumericUpDown();
			this.editLabel = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.bottomPanel.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.XPos)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.YPos)).BeginInit();
			this.SuspendLayout();
			// 
			// bottomPanel
			// 
			this.bottomPanel.Location = new System.Drawing.Point(0, 53);
			this.bottomPanel.Size = new System.Drawing.Size(294, 35);
			this.bottomPanel.TabIndex = 2;
			this.bottomPanel.Visible = true;
			// 
			// cancelButton
			// 
			this.cancelButton.Visible = true;
			// 
			// okButton
			// 
			this.okButton.Visible = true;
			// 
			// XPos
			// 
			this.XPos.Location = new System.Drawing.Point(34, 29);
			this.XPos.Maximum = new System.Decimal(new int[] {
																 3000,
																 0,
																 0,
																 0});
			this.XPos.Name = "XPos";
			this.XPos.Size = new System.Drawing.Size(100, 20);
			this.XPos.TabIndex = 0;
			this.XPos.Value = new System.Decimal(new int[] {
															   150,
															   0,
															   0,
															   0});
			this.XPos.KeyDown += new System.Windows.Forms.KeyEventHandler(this.YPos_KeyDown);
			// 
			// YPos
			// 
			this.YPos.Location = new System.Drawing.Point(184, 29);
			this.YPos.Maximum = new System.Decimal(new int[] {
																 3000,
																 0,
																 0,
																 0});
			this.YPos.Name = "YPos";
			this.YPos.Size = new System.Drawing.Size(100, 20);
			this.YPos.TabIndex = 1;
			this.YPos.Value = new System.Decimal(new int[] {
															   150,
															   0,
															   0,
															   0});
			this.YPos.KeyDown += new System.Windows.Forms.KeyEventHandler(this.YPos_KeyDown);
			// 
			// editLabel
			// 
			this.editLabel.AutoSize = true;
			this.editLabel.Location = new System.Drawing.Point(15, 8);
			this.editLabel.Name = "editLabel";
			this.editLabel.Size = new System.Drawing.Size(48, 13);
			this.editLabel.TabIndex = 4;
			this.editLabel.Text = "Position:";
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(15, 33);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(15, 13);
			this.label1.TabIndex = 5;
			this.label1.Text = "X:";
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(163, 33);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(15, 13);
			this.label2.TabIndex = 6;
			this.label2.Text = "Y:";
			// 
			// PositionForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(294, 88);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.label2,
																		  this.label1,
																		  this.editLabel,
																		  this.YPos,
																		  this.bottomPanel,
																		  this.XPos});
			this.Name = "PositionForm";
			this.Text = "Please specify end position";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.PositionForm_Closing);
			this.bottomPanel.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.XPos)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.YPos)).EndInit();
			this.ResumeLayout(false);

		}		#endregion

		private void PositionForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			this._value = new Point( (int)this.XPos.Value, (int)this.YPos.Value );
		}

		private void YPos_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if( e.KeyCode == Keys.Return ){
				this.DialogResult = DialogResult.OK;
				this.Close();
			}
		}	}}

⌨️ 快捷键说明

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