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

📄 form1.cs

📁 C#的实例程序
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;

namespace WinApp
{
	using System.Drawing;
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : Form
	{
		private Image img;
		private bool slatOut=false;
		private System.ComponentModel.IContainer components;
		private Timer time1 = new Timer();

		private Rectangle rect = new Rectangle(100,100,130,70);
		private System.Windows.Forms.PictureBox Playing;
		private System.Windows.Forms.PictureBox Circle;
		private System.Windows.Forms.PictureBox CDAudio;
		private System.Windows.Forms.PictureBox smBut;
		private System.Windows.Forms.PictureBox stopBut;

		Point pt = new Point(200,100);

		private bool blnMoving = false;
		private int MouseDownX;
		private System.Windows.Forms.Label disp;
		private System.Windows.Forms.Button Ex;
		private int MouseDownY;
		private bool playFlg=false;
        
		private ArrayList imgList = new ArrayList();
		private System.Windows.Forms.Label tm;
		private System.Windows.Forms.PictureBox animatPicture;
		private int cnt = -1;
		public Form1()
		{
			time1.Interval = 100;
			time1.Enabled = true;
			time1.Tick += new EventHandler(time1_Tick);


			img = new Bitmap("mediaPlayer.jpg");

			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			this.CDAudio.Image = System.Drawing.Bitmap.FromFile("CDAudio.jpg");
			this.Playing.Image = System.Drawing.Bitmap.FromFile("PlayingUp.jpg");
			this.Circle.Image = System.Drawing.Bitmap.FromFile("Circle.jpg");
			this.smBut.Image = System.Drawing.Bitmap.FromFile("buttonNormal.jpg");
			this.stopBut.Image = System.Drawing.Bitmap.FromFile("stopButNormal.jpg");

			Application.ApplicationExit += new EventHandler(Form_OnExit);
			
			//	Application.AddMessageFilter(msgFilter);
		}

		private void Form_OnExit(object sender, EventArgs evArgs)
		{
		}

        /// <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 Windows Form 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.CDAudio = new System.Windows.Forms.PictureBox();
            this.smBut = new System.Windows.Forms.PictureBox();
            this.Circle = new System.Windows.Forms.PictureBox();
            this.Ex = new System.Windows.Forms.Button();
            this.stopBut = new System.Windows.Forms.PictureBox();
            this.Playing = new System.Windows.Forms.PictureBox();
            this.disp = new System.Windows.Forms.Label();
            this.tm = new System.Windows.Forms.Label();
            this.animatPicture = new System.Windows.Forms.PictureBox();
            this.SuspendLayout();
            // 
            // CDAudio
            // 
            this.CDAudio.Location = new System.Drawing.Point(16, 120);
            this.CDAudio.Name = "CDAudio";
            this.CDAudio.Size = new System.Drawing.Size(88, 40);
            this.CDAudio.TabIndex = 4;
            this.CDAudio.TabStop = false;
            this.CDAudio.Click += new System.EventHandler(this.pictureBox1_Click);
            this.CDAudio.MouseEnter += new System.EventHandler(this.CDAudio_MouseEnter);
            this.CDAudio.MouseLeave += new System.EventHandler(this.CDAudio_MouseLeave);
            // 
            // smBut
            // 
            this.smBut.Location = new System.Drawing.Point(464, 104);
            this.smBut.Name = "smBut";
            this.smBut.Size = new System.Drawing.Size(16, 32);
            this.smBut.TabIndex = 6;
            this.smBut.TabStop = false;
            this.smBut.Click += new System.EventHandler(this.smBut_Click);
            this.smBut.MouseEnter += new System.EventHandler(this.smBut_MouseEnter);
            this.smBut.MouseLeave += new System.EventHandler(this.smBut_MouseLeave);
            // 
            // Circle
            // 
            this.Circle.Location = new System.Drawing.Point(104, 200);
            this.Circle.Name = "Circle";
            this.Circle.Size = new System.Drawing.Size(72, 64);
            this.Circle.TabIndex = 3;
            this.Circle.TabStop = false;
            this.Circle.Click += new System.EventHandler(this.Circle_Click);
            this.Circle.MouseEnter += new System.EventHandler(this.Circle_MouseEnter);
            this.Circle.MouseLeave += new System.EventHandler(this.Circle_MouseLeave);
            // 
            // Ex
            // 
            this.Ex.BackColor = System.Drawing.Color.LightGray;
            this.Ex.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.Ex.ForeColor = System.Drawing.Color.Black;
            this.Ex.Location = new System.Drawing.Point(456, 16);
            this.Ex.Name = "Ex";
            this.Ex.Size = new System.Drawing.Size(18, 16);
            this.Ex.TabIndex = 5;
            this.Ex.Text = "X";
            this.Ex.Click += new System.EventHandler(this.button1_Click_1);
            this.Ex.MouseEnter += new System.EventHandler(this.Ex_MouseEnter);
            this.Ex.MouseLeave += new System.EventHandler(this.Ex_MouseLeave);
            // 
            // stopBut
            // 
            this.stopBut.Location = new System.Drawing.Point(176, 224);
            this.stopBut.Name = "stopBut";
            this.stopBut.Size = new System.Drawing.Size(32, 48);
            this.stopBut.TabIndex = 7;
            this.stopBut.TabStop = false;
            this.stopBut.Click += new System.EventHandler(this.stopBut_Click);
            this.stopBut.MouseEnter += new System.EventHandler(this.stopBut_MouseEnter);
            this.stopBut.MouseLeave += new System.EventHandler(this.stopBut_MouseLeave);
            // 
            // Playing
            // 
            this.Playing.Location = new System.Drawing.Point(16, 72);
            this.Playing.Name = "Playing";
            this.Playing.Size = new System.Drawing.Size(88, 40);
            this.Playing.TabIndex = 2;
            this.Playing.TabStop = false;
            this.Playing.Click += new System.EventHandler(this.Playing_Click);
            this.Playing.MouseEnter += new System.EventHandler(this.Playing_MouseEnter);
            this.Playing.MouseLeave += new System.EventHandler(this.Playing_MouseLeave);
            // 
            // disp
            // 
            this.disp.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.disp.BackColor = System.Drawing.Color.Black;
            this.disp.ForeColor = System.Drawing.Color.Lime;
            this.disp.Location = new System.Drawing.Point(224, 216);
            this.disp.Name = "disp";
            this.disp.Size = new System.Drawing.Size(200, 21);
            this.disp.TabIndex = 8;
            // 
            // tm
            // 
            this.tm.BackColor = System.Drawing.Color.Black;
            this.tm.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(255)), ((System.Byte)(128)));
            this.tm.Location = new System.Drawing.Point(376, 216);
            this.tm.Name = "tm";
            this.tm.Size = new System.Drawing.Size(92, 21);
            this.tm.TabIndex = 9;
            // 
            // animatPicture
            // 
            this.animatPicture.BackColor = System.Drawing.Color.Black;
            this.animatPicture.Location = new System.Drawing.Point(164, 46);
            this.animatPicture.Name = "animatPicture";
            this.animatPicture.Size = new System.Drawing.Size(292, 158);
            this.animatPicture.TabIndex = 10;
            this.animatPicture.TabStop = false;
            this.animatPicture.Tag = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
                | System.Windows.Forms.AnchorStyles.Right);
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.BackColor = System.Drawing.Color.Silver;
            this.ClientSize = new System.Drawing.Size(852, 731);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.animatPicture,
                                                                          this.tm,
                                                                          this.disp,
                                                                          this.stopBut,
                                                                          this.smBut,
                                                                          this.Ex,
                                                                          this.CDAudio,
                                                                          this.Circle,
                                                                          this.Playing});
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            this.TransparencyKey = System.Drawing.Color.Silver;
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
            this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form_Paint);
            this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
            this.ResumeLayout(false);

        }
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form_Paint(object sender, PaintEventArgs e)
		{
			Graphics g = e.Graphics;
			Rectangle mainRect = new Rectangle(0, 0, 695, 278);
			Region mainRegion = new Region(mainRect);
			e.Graphics.SetClip(mainRegion, CombineMode.Replace);
    
			Point point1 = new Point(0, 32);

⌨️ 快捷键说明

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