form1.cs

来自「这是网上下载的很好的串口发短信的程序! 是用VC++来做的」· CS 代码 · 共 90 行

CS
90
字号
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using DDGameHelper;

namespace ddt2
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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

			this.ClientSize = new System.Drawing.Size(GameSettings._screenWidth, GameSettings._screenHeight);

			Show();		//这句确保 form load 完成之后再进入游戏循环,否则要出错

			Cursor = Cursors.Arrow;			// 设置或隐藏光标

			GameLoopHandler gl=new GameLoopHandler(this);

			int w=this.ClientSize.Width;
			int h=this.ClientSize.Height;

			GameSettings.GameLoopSetAndStart(ref gl);
		}

		private void Form1_Resize(object sender, System.EventArgs e)
		{
			//确保 form 的最小尺寸
			if(Height<120)Height=120;
			if(Width<160)Width=160;
		}

		/// <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.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "DirectDrawTest2";
			this.Resize += new System.EventHandler(this.Form1_Resize);
		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Form f=new Form1();
			Application.Exit();
		}
	}
}

⌨️ 快捷键说明

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