您当前的位置:首页 > 文章摘抄 > 正文

suspendlayout(C#点击按钮控制进度条)

本文目录

  • C#点击按钮控制进度条
  • c#怎么关闭messagebox
  • C#如何设置combobox下拉框的内容
  • c# this.suspendlayout有什么作用
  • C#中什么是消息,解释越详细越多越好
  • C#定时执行
  • C#的程序执行顺序
  • C# 挂起控件的布局逻辑有什么用
  • 如何用c#做一个秒表
  • 如何让C#程序发声

C#点击按钮控制进度条

1、我们在ProgressBar的Value属性中设置为100。 Name 为pgbBlood2、一个button,name属性为btnPuse,click事件设置为btnPush_Click3、一个button,name为btnDecrese,click事件为btnDecrese_Click4、在btnPush_Click事件中写 private void btnPush_Click(object sender, RoutedEventArgs e) { if (pgbBlood.Value==100) { MessageBox.Show(“已经满了“); } } pgbBlood.Value += 10;5在btnDecrese_Click事件中写 private void btnDecrese_Click(object sender, RoutedEventArgs e) { if (pgbBlood.Value==0) { MessageBox.Show(“不能再减了“); } pgbBlood.Value -= 10; }这就够了,布局在前台做就好了,需要上面那么多代码吗?

c#怎么关闭messagebox

using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Runtime.InteropServices;namespace MyTest...{    /**//// 《summary》    /// Form1 的摘要说明。    /// 《/summary》    public class Form1 : System.Windows.Forms.Form    ...{        private System.Windows.Forms.Button button1;        /**//// 《summary》        /// 必需的设计器变量。        /// 《/summary》        private System.ComponentModel.Container components = null;        public Form1()        ...{            //            // Windows 窗体设计器支持所必需的            //            InitializeComponent();            //            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码            //        }        /**//// 《summary》        /// 清理所有正在使用的资源。        /// 《/summary》        protected override void Dispose( bool disposing )        ...{            if( disposing )            ...{                if (components != null)                 ...{                    components.Dispose();                }            }            base.Dispose( disposing );        }        Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码        /**//// 《summary》        /// 设计器支持所需的方法 - 不要使用代码编辑器修改        /// 此方法的内容。        /// 《/summary》        private void InitializeComponent()        ...{            this.button1 = new System.Windows.Forms.Button();            this.SuspendLayout();            //             // button1            //             this.button1.Location = new System.Drawing.Point(176, 48);            this.button1.Name = “button1“;            this.button1.Size = new System.Drawing.Size(96, 24);            this.button1.TabIndex = 0;            this.button1.Text = “button1“;            this.button1.Click += new System.EventHandler(this.button1_Click);            //             // Form1            //             this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);            this.ClientSize = new System.Drawing.Size(292, 266);            this.Controls.Add(this.button1);            this.Name = “Form1“;            this.Text = “Form1“;            this.ResumeLayout(false);        }        #endregion        /**//// 《summary》        /// 应用程序的主入口点。        /// 《/summary》        [STAThread]        static void Main()         ...{            Application.Run(new Form1());        }        private void button1_Click(object sender, System.EventArgs e)        ...{            StartKiller();            MessageBox.Show(“这里是MessageBox弹出的内容“,“MessageBox“);            MessageBox.Show(“这里是跟随运行的窗口“,“窗口“);        }        private void StartKiller()        ...{            Timer timer = new Timer();            timer.Interval = 10000;    //10秒启动            timer.Tick += new EventHandler(Timer_Tick);            timer.Start();        }        private void Timer_Tick(object sender, EventArgs e)        ...{            KillMessageBox();            //停止计时器            ((Timer)sender).Stop();        }        private void KillMessageBox()        ...{            //查找MessageBox的弹出窗口,注意对应标题            IntPtr ptr = FindWindow(null,“MessageBox“);            if(ptr != IntPtr.Zero)            ...{                //查找到窗口则关闭                PostMessage(ptr,WM_CLOSE,IntPtr.Zero,IntPtr.Zero);            }        }        [DllImport(“user32.dll“, EntryPoint = “FindWindow“, CharSet=CharSet.Auto)]        private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);        [DllImport(“user32.dll“, CharSet=CharSet.Auto)]        public static extern int PostMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);        public const int WM_CLOSE = 0x10;    }

C#如何设置combobox下拉框的内容

1、首先,我们新键一个Winform窗体应用程序,然后在界面上,放置一个下拉框。

2、在CS类里面编辑代码,为下拉框绑定值,用来显示效果。

3、回到form界面,选中下拉框,在属性面板中,选择属性DropDownHeight,这个属性就是这只下拉框的高度的属性。

4、首先,我们设置下拉框的高度为200,然后,我们调试程序,看看显示效果。

5、然后,我们关闭界面,把这个属性的值设置为100。

6、设置完毕后,我们再重启下看看效果。

7、根据两次的对比,我们可以发现,这个属性设置的高度不同,下拉框显示的高度是不同的。

c# this.suspendlayout有什么作用

为了防止layout事件的发生。这个事件将引发重新绘图的事件,如果介面上控件较多的话,改变控件某些属性时,由于不断地重画,性能变低,所以用suspendlayout来阻止。resumelayou可以结束上面的限制。

C#中什么是消息,解释越详细越多越好

消息就是通知和命令。1 什么是消息(Message) 消息就是通知和命令。在.NET框架类库中的System.Windows.Forms命名空间中微软采用面对对象的方式重新定义了Message。新的消息(Message)结构的公共部分属性基本与早期的一样,不过它是面对对象的。公共属性: HWnd 获取或设定消息的处理函数Msg 获取或设定消息的ID号Lparam 指定消息的LParam字段Wparam 指定消息的WParam字段Result 指定为响应消息处理函数而向OS系统返回的值2 消息驱动的过程 所有的外部事件,如键盘输入、鼠标移动、按动鼠标都由OS系统转换成相应的消息发送到应用程序的消息队列。每个应用程序都有一段相应的程序代码来检索、分发这些消息到对应的窗体,然后由窗体的处理函数来处理。二、C#中的消息的封装 C#对消息重新进行了面对对象的封装,在C#中消息被封装成了事件。System.Windows.Forms.Application类具有用于启动和停止应用程序和线程以及处理Windows消息的方法。调用Run以启动当前线程上的应用程序消息循环,并可以选择使其窗体可见。调用Exit或ExitThread来停止消息循环。C#中用Application类来处理消息的接收和发送的。消息的循环是由它负责的。从本质上来讲,每个窗体一般都对应一个窗体过程处理函数。那么,C#的一个Form实例(相当于一个窗体)收到消息后是如何处理消息的?其实,这个问题的分析也就是展示了C#的消息封装原理。 实现鼠标左键按下的消息的响应(WM_LBUTTONDOWN) this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown1);this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown2); private void Form1_MouseDown1(object sender, System.Windows.Forms.MouseEventArgs e){if(e.Button==System.Windows.Forms.MouseButtons.Left)System.Windows.Forms.MessageBox.Show(“消息被Form1_MouseDown1函数响应“);} private void Form1_MouseDown2(object sender, System.Windows.Forms.MouseEventArgs e){if(e.Button==System.Windows.Forms.MouseButtons.Left)System.Windows.Forms.MessageBox.Show(“消息被Form1_MouseDown2函数响应“);}上面this.MouseDown是C#中的一个事件。它的定义如下: public event MouseEventHandler MouseDown;而MouseEventHandler的定义为: public delegate void MouseEventHandler( object sender,MouseEventArgs e); 实际上,上面定义了一个委托类型MouseEventHandler。委托了启用了其它编程语言中的函数指针的解决方案。与C++的函数指针不同,委托是完全面向对象的,同时封装了对象实例和方法。本质上,委托把一个实例和该实例上的方法函数封装成一个可调用的实体,它是面对对象的、安全的。 我们可以把this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown1);这条语句看成向this.MouseDown添加一个函数指针。 事件是对象发送的消息,以发送信号通知操作的发生。引发(触发)事件的对象叫做事件发送方。捕获事件并对事件作出响应的对象叫做事件接收方。在事件通讯中,事件发送方类并不知道哪个对象或方法将接收到(处理)它引发的事件。所需要的是在发送方和接收方之间存在一个媒介(类似指针的机制)。.NET框架定义了一个特殊的类型(Delegate委托),该类型提供函数指针的功能。这样,委托就等效于一个类型安全的函数指针或一个回调函数。 前面我们向this.MouseDown事件添加了两个委托。this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown1);this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown2);结果,我们的两个函数Form1_MouseDown1、Form1_MouseDown2在我们单击鼠标左键的时候都会被调用,而且调用的顺序和我们添加委托的顺序一致。 WM_LBUTTONDOWN消息首先被Application类从应用程序消息队列中取出,然后分发到相应的窗体。窗体使用MouseDown事件中的函数指针调用已经添加的响应函数。所以C#中的事件字段实质上是一个函数指针列表,用来维护一些消息到达时的响应函数的地址。 三、结论 C#中消息的工作流程: C#中的消息被Application类从应用程序消息队列中取出,然后分发到消息对应的窗体,窗体对象的第一个响应函数是对象中的protected override void WndProc(ref System.Windows.Forms.Message e)方法。它再根据消息的类型调用默认的消息响应函数(如OnMouseDown),默认的响应函数然后根据对象的事件字段(如this.MouseDown )中的函数指针列表,调用用户所加入的响应函数(如Form1_MouseDown1和Form1_MouseDown2),而且调用顺序和用户添加顺序一致。四、再回首Application类 Application类有一个AddMessageFilter的静态方法,通过它我们可以添加消息筛选器,以便在向目标传递Windows消息时,检视这些消息。使用消息筛选器来防止引发特定事件,或在将某事件传递给事件处理程序之前使用消息筛选器对其执行特殊操作。我们必须提供IMessageFilter接口的一个实现,然后才可以使用消息筛选器。以下的示范代码将演示在消息发往窗体前我们如何拦截它。我们拦截的同样是WM_LBUTTONDOWN消息。using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data;namespace MessageMech3 {//实现消息过滤器接口public class CLButtonDownFilter : IMessageFilter{public bool PreFilterMessage(ref Message m){if (m.Msg==0x0201)// WM_LBUTTONDOWN{System.Windows.Forms.MessageBox.Show(“App中鼠标左键按下“);//返回值为true, 表示消息已被处理,不要再往后传递,因此消息被截获//返回值为false,表示消息未被处理,需要再往后传递,因此消息未被截获return true;}return false;}} /// 《summary》/// Summary description for WinForm./// 《/summary》public class WinForm : System.Windows.Forms.Form{/// 《summary》/// Required designer variable./// 《/summary》private System.Windows.Forms.Label label1;private System.ComponentModel.Container components = null; public WinForm(){//// Required for Windows Form Designer support//InitializeComponent(); //// TODO: Add any constructor code after InitializeComponent call////安装自己的过滤器CLButtonDownFilter MyFilter=new CLButtonDownFilter();System.Windows.Forms.Application.AddMessageFilter(MyFilter);} /// 《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.label1 = new System.Windows.Forms.Label();this.SuspendLayout();//// label1//this.label1.BackColor = System.Drawing.Color.Transparent;this.label1.Dock = System.Windows.Forms.DockStyle.Top;this.label1.ForeColor = System.Drawing.Color.DarkViolet;this.label1.Name = “label1“;this.label1.Size = new System.Drawing.Size(440, 32);this.label1.TabIndex = 0;this.label1.Text = “演示如何在App对象中处理消息,请点鼠标左键“;this.label1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;//// Form1//this.AutoScaleBaseSize = new System.Drawing.Size(7, 22);this.BackColor = System.Drawing.Color.WhiteSmoke;this.ClientSize = new System.Drawing.Size(440, 273);this.Controls.AddRange(new System.Windows.Forms.Control {this.label1});this.Font = new System.Drawing.Font(“华文行楷“, 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));this.Name = “WinForm“;this.Text = “WinForm“; //消息响应函数的调用顺序和添加委托的顺序一致//即:以下命令将先调用Form1_MouseDown1再调用Form1_MouseDown2 //通过委托添加自己的鼠标按键消息响应函数1this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown1);//通过委托添加自己的鼠标按键消息响应函数2this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown2); this.ResumeLayout(false);}#endregion /// 《summary》/// 应用程序的主入口点。/// 《/summary》[STAThread]static void Main(){Application.Run(new WinForm()); //启动当前Form线程上的应用程序消息循环} //要点1// 通过C#提供的事件接口添加自己的鼠标按键事件的响应函数//private void Form1_MouseDown1(object sender, System.Windows.Forms.MouseEventArgs e){if(e.Button==System.Windows.Forms.MouseButtons.Left)System.Windows.Forms.MessageBox.Show(“消息被Form1_MouseDown1函数响应“); }private void Form1_MouseDown2(object sender, System.Windows.Forms.MouseEventArgs e){if(e.Button==System.Windows.Forms.MouseButtons.Left)System.Windows.Forms.MessageBox.Show(“消息被Form1_MouseDown2函数响应“); }//要点2//通过覆盖基类的事件引发函数拦截消息//protected override void onm ouseDown( MouseEventArgs e){if(e.Button==System.Windows.Forms.MouseButtons.Left)System.Windows.Forms.MessageBox.Show(“消息被OnMouseDown函数响应“); //如果需要截获消息,可将base.OnMouseDown(e);语句注释掉base.OnMouseDown(e);}//要点3//通过覆盖基类的窗体函数拦截消息//protected override void WndProc(ref System.Windows.Forms.Message e){//如果需要截获消息,//if(e.Msg==0x0201)// WM_LBUTTONDOWN// System.Windows.Forms.MessageBox.Show(“消息被WndProc函数响应“);//else// base.WndProc(ref e); //不需要截获消息则为if(e.Msg==0x0201)// WM_LBUTTONDOWNSystem.Windows.Forms.MessageBox.Show(“消息被WndProc函数响应“);base.WndProc(ref e);} } } 以上代码我们首先用类CLButtonDownFilter实现了IMessageFilter接口,在WinForm初始化的时候我们安装了消息筛选器。程序实际执行的时候,在点击鼠标左键的时候,程序仅仅会弹出一个“App中鼠标左键按下“的消息框。因为我们在消息发往窗体前拦截了它,所以窗体将接收不到WM_LBUTTONDOWN消息。如果我们把if (m.Msg==0x0201)// WM_LBUTTONDOWN{System.Windows.Forms.MessageBox.Show(“App中鼠标左键按下“);return true;}改成 if (m.Msg==0x0201)// WM_LBUTTONDOWN{System.Windows.Forms.MessageBox.Show(“App中鼠标左键按下“);return false;}那么,我们在Application类处理消息后,消息将继续发往窗体。窗体的函数将可以处理此消息。程序执行效果是顺序弹出5个消息框。1:《《App中鼠标左键按下》》2:《《消息被WndProc函数响应》》3:《《消息被OnMouseDown函数响应》》4:《《消息被Form1_MouseDown1函数响应》》5:《《消息被Form1_MouseDown2函数响应》》 其实本文中已经说的挺详细的.弹出的对话框只是为了让你更直观的看出导致的结果.先定义没过滤时的效果. this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown1); private void Form1_MouseDown1(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) MessageBox.Show(“消息被Form1_MouseDown1函数响应“); } 主要有两种方法过滤实现过滤 第一种: protected override void WndProc(ref Message m) { if (m.Msg == 0x0201) return; else base.WndProc(ref m); } 第二种 不重写WndProc//实现消息过滤器接口 public class CLButtonDownFilter : IMessageFilter { public bool PreFilterMessage(ref Message m) { if (m.Msg == 0x0201)// WM_LBUTTONDOWN { //返回值为true, 表示消息已被处理,不要再往后传递,因此消息被截获 //返回值为false,表示消息未被处理,需要再往后传递,因此消息未被截获 return true; } return false; } }CLButtonDownFilter MyFilter = new CLButtonDownFilter(); System.Windows.Forms.Application.AddMessageFilter(MyFilter);

C#定时执行

启动程序的时候,就执行启动状态的任务? 用 Loaded 事件呀。每隔一段时间执行:建立一个 List《Timer》 型变量每添加一个任务,就:变量名.Add(new Timer())可用 变量名[索引] 的方法向数组一样访问。并设置属性 Interval, Enabled = True ,设定事件 变量名[索引].Tick+= 事件处理函数(这个函数要预先写好(不同种任务用不同函数,或用参数区分))定时执行 用一个Timer检查 DateTime.Now==定时的时间 就分情况执行不同任务(调用不同函数)。-------------------------------------------------补充:List《Type》是一个泛型的类。既然叫List,它有列表的作用,类似于数组,又优于数组:数组的元素个数必须是确定,而List《》不确定。而List可以与数组一样访问。既然是泛型,里面可以存任意同类型的变量。的尖括号中Type就是你想要的类型。-----------------------------------------//Form1.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example_Task{ public partial class Form1 : Form { List《Task》 lt = new List《Task》(); //任务列表 List《Timer》 cycleT=new List《Timer》(); //管理周期性任务 Timer timingT=new Timer(); //管理定时任务 enum condition { cycle, timing }; //任务执行条件 public enum tType { a, b, c }; //任务类型 tType type; bool Condition; public Form1() { InitializeComponent(); timingT.Tick += new EventHandler(timingT_Tick); timingT.Enabled = true; } void timingT_Tick(object sender, EventArgs e) { foreach (Task t in lt) { if (!t.Condition) { if (DateTime.Now == t.Time) { switch (t.Kind) { case tType.a: a(timingT, new EventArgs()); break; case tType.b: b(timingT, new EventArgs()); break; case tType.c: c(timingT, new EventArgs()); break; } } } } } void a(object sender,EventArgs e) { label1.Text += ’a’; } void b(object sender,EventArgs e) { label1.Text += ’b’; } void c(object sender,EventArgs e) { label1.Text += ’c’; } private void button1_Click(object sender, EventArgs e) { groupBox1.Visible = true; } private void tType_CheckedChanged(object sender, EventArgs e) { switch (((RadioButton)sender).Text) { case “a“: type = tType.a; break; case “b“: type = tType.b; break; case “c“: type = tType.c; break; } } private void Condition_CheckedChanged(object sender, EventArgs e) { numericUpDown1.Enabled = Condition = radioButton2.Equals(sender); maskedTextBox1.Enabled = !Condition; } private void button3_Click(object sender, EventArgs e) { if (textBox1.Text != string.Empty) { try { if (Condition) { lt.Add(new Task(textBox1.Text, type, Condition, (int)numericUpDown1.Value)); Timer t=new Timer(); t.Interval=(int)numericUpDown1.Value*1000; t.Enabled = true; switch (type) { case tType.a: t.Tick += new EventHandler(a); break; case tType.b: t.Tick += new EventHandler(b); break; case tType.c: t.Tick += new EventHandler(c); break; } cycleT.Add(t); } else { lt.Add(new Task(textBox1.Text, type, Condition, DateTime.Parse(maskedTextBox1.Text))); } listBox1.Items.Add(textBox1.Text); } catch { } finally { groupBox1.Hide(); } } } } public class Task { public string Name { get; set; } public Form1.tType Kind { get; set; } public bool Condition { get; set; } public int sec { get; set; } public DateTime Time { get; set; } //定义各种属性描述这个任务 public Task(string name, Form1.tType kind, bool condition, int seconds) { Name = name; Kind = kind; Condition = condition; sec = seconds;//初始化 } public Task(string name, Form1.tType kind, bool condition, DateTime d) { Name = name; Kind = kind; Condition = condition; Time = d;//初始化 } }}//-------------------------------------------------//-------------------------------------------------//-------------------------------------------------//Form1.Designer.csnamespace Example_Task{ partial class Form1 { /// 《summary》 /// 必需的设计器变量。 /// 《/summary》 private System.ComponentModel.IContainer components = null; /// 《summary》 /// 清理所有正在使用的资源。 /// 《/summary》 /// 《param name=“disposing“》如果应释放托管资源,为 true;否则为 false。《/param》 protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// 《summary》 /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// 《/summary》 private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.listBox1 = new System.Windows.Forms.ListBox(); this.button1 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.button3 = new System.Windows.Forms.Button(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.label3 = new System.Windows.Forms.Label(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.radioButton5 = new System.Windows.Forms.RadioButton(); this.radioButton4 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox(); this.groupBox1.SuspendLayout(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(12, 137); this.label1.Name = “label1“; this.label1.Size = new System.Drawing.Size(590, 334); this.label1.TabIndex = 0; this.label1.Text = “任务运行情况 - “; // // listBox1 // this.listBox1.FormattingEnabled = true; this.listBox1.ItemHeight = 12; this.listBox1.Location = new System.Drawing.Point(12, 9); this.listBox1.Name = “listBox1“; this.listBox1.Size = new System.Drawing.Size(238, 124); this.listBox1.TabIndex = 1; // // button1 // this.button1.Location = new System.Drawing.Point(258, 23); this.button1.Name = “button1“; this.button1.Size = new System.Drawing.Size(75, 97); this.button1.TabIndex = 2; this.button1.Text = “New Task“; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.button3); this.groupBox1.Controls.Add(this.groupBox3); this.groupBox1.Controls.Add(this.groupBox2); this.groupBox1.Controls.Add(this.textBox1); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(339, 9); this.groupBox1.Name = “groupBox1“; this.groupBox1.Size = new System.Drawing.Size(263, 125); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = “TaskInfo“; this.groupBox1.Visible = false; // // button3 // this.button3.Location = new System.Drawing.Point(172, 12); this.button3.Name = “button3“; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 4; this.button3.Text = “OK“; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // // groupBox3 // this.groupBox3.Controls.Add(this.maskedTextBox1); this.groupBox3.Controls.Add(this.radioButton3); this.groupBox3.Controls.Add(this.label3); this.groupBox3.Controls.Add(this.numericUpDown1); this.groupBox3.Controls.Add(this.radioButton2); this.groupBox3.Location = new System.Drawing.Point(74, 41); this.groupBox3.Name = “groupBox3“; this.groupBox3.Size = new System.Drawing.Size(183, 78); this.groupBox3.TabIndex = 3; this.groupBox3.TabStop = false; this.groupBox3.Text = “Condition“; // // radioButton3 // this.radioButton3.AutoSize = true; this.radioButton3.Location = new System.Drawing.Point(6, 35); this.radioButton3.Name = “radioButton3“; this.radioButton3.Size = new System.Drawing.Size(89, 16); this.radioButton3.TabIndex = 3; this.radioButton3.TabStop = true; this.radioButton3.Text = “CertainTime“; this.radioButton3.UseVisualStyleBackColor = true; this.radioButton3.CheckedChanged += new System.EventHandler(this.Condition_CheckedChanged); // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(122, 18); this.label3.Name = “label3“; this.label3.Size = new System.Drawing.Size(47, 12); this.label3.TabIndex = 2; this.label3.Text = “Seconds“; // // numericUpDown1 // this.numericUpDown1.Enabled = false; this.numericUpDown1.Location = new System.Drawing.Point(60, 13); this.numericUpDown1.Name = “numericUpDown1“; this.numericUpDown1.Size = new System.Drawing.Size(61, 21); this.numericUpDown1.TabIndex = 1; this.numericUpDown1.Value = new decimal(new int { 1, 0, 0, 0}); // // radioButton2 // this.radioButton2.AutoSize = true; this.radioButton2.Location = new System.Drawing.Point(6, 14); this.radioButton2.Name = “radioButton2“; this.radioButton2.Size = new System.Drawing.Size(53, 16); this.radioButton2.TabIndex = 0; this.radioButton2.TabStop = true; this.radioButton2.Text = “Every“; this.radioButton2.UseVisualStyleBackColor = true; this.radioButton2.CheckedChanged += new System.EventHandler(this.Condition_CheckedChanged); // // groupBox2 // this.groupBox2.Controls.Add(this.radioButton5); this.groupBox2.Controls.Add(this.radioButton4); this.groupBox2.Controls.Add(this.radioButton1); this.groupBox2.Location = new System.Drawing.Point(6, 41); this.groupBox2.Name = “groupBox2“; this.groupBox2.Size = new System.Drawing.Size(63, 78); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = “Type“; // // radioButton5 // this.radioButton5.AutoSize = true; this.radioButton5.Location = new System.Drawing.Point(6, 56); this.radioButton5.Name = “radioButton5“; this.radioButton5.Size = new System.Drawing.Size(29, 16); this.radioButton5.TabIndex = 2; this.radioButton5.TabStop = true; this.radioButton5.Text = “c“; this.radioButton5.UseVisualStyleBackColor = true; this.radioButton5.CheckedChanged += new System.EventHandler(this.tType_CheckedChanged); // // radioButton4 // this.radioButton4.AutoSize = true; this.radioButton4.Location = new System.Drawing.Point(6, 38); this.radioButton4.Name = “radioButton4“; this.radioButton4.Size = new System.Drawing.Size(29, 16); this.radioButton4.TabIndex = 1; this.radioButton4.TabStop = true; this.radioButton4.Text = “b“; this.radioButton4.UseVisualStyleBackColor = true; this.radioButton4.CheckedChanged += new System.EventHandler(this.tType_CheckedChanged); // // radioButton1 // this.radioButton1.AutoSize = true; this.radioButton1.Location = new System.Drawing.Point(6, 16); this.radioButton1.Name = “radioButton1“; this.radioButton1.Size = new System.Drawing.Size(29, 16); this.radioButton1.TabIndex = 0; this.radioButton1.TabStop = true; this.radioButton1.Text = “a“; this.radioButton1.UseVisualStyleBackColor = true; this.radioButton1.CheckedChanged += new System.EventHandler(this.tType_CheckedChanged); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(53, 14); this.textBox1.Name = “textBox1“; this.textBox1.Size = new System.Drawing.Size(100, 21); this.textBox1.TabIndex = 1; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(18, 17); this.label2.Name = “label2“; this.label2.Size = new System.Drawing.Size(29, 12); this.label2.TabIndex = 0; this.label2.Text = “Name“; // // maskedTextBox1 // this.maskedTextBox1.Enabled = false; this.maskedTextBox1.Location = new System.Drawing.Point(6, 51); this.maskedTextBox1.Mask = “0000-00-00 90:00:00“; this.maskedTextBox1.Name = “maskedTextBox1“; this.maskedTextBox1.Size = new System.Drawing.Size(143, 21); this.maskedTextBox1.TabIndex = 4; this.maskedTextBox1.ValidatingType = typeof(System.DateTime); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(614, 480); this.Controls.Add(this.groupBox1); this.Controls.Add(this.button1); this.Controls.Add(this.listBox1); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Name = “Form1“; this.Text = “Form1“; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.ListBox listBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button button3; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.RadioButton radioButton3; private System.Windows.Forms.Label label3; private System.Windows.Forms.NumericUpDown numericUpDown1; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.RadioButton radioButton4; private System.Windows.Forms.RadioButton radioButton5; private System.Windows.Forms.MaskedTextBox maskedTextBox1; }}/*没有太多的容错方法,为了简洁,尽量直达目的。这个窗体可以定时或周期性执行任务仔细看看Form1.cs有点多线程的思路,但这里没有用多线程。只要改写a(),b(),c() 就能完成你的任务,用同样的方法添加函数对应不同任务种类。这下改明白了吧多加点分吧*/

C#的程序执行顺序

  第一:进入static void Main()  第二:运行static void Main() 中的Application.Run(new Form1());在这中间对窗体进行构造。  执行private System.ComponentModel.Container components = null;作用是Container 类是IContainer 接口的默认实现。容器是封装和跟踪零个或更多个组件的对象。在此上下文中,包容是指逻辑包荣, 而不是直观包容。可以在多种方案下使用组件和容器,包括可视化方案和非可视化方案。  在一个先入先出列表中跟踪容器中的组件,该列表也定义了容器内组件的顺序。  所添加的组件会附加到列表的结尾。  执行窗体构造函数public Form1()初始化窗体  执行构造函数中的InitializeComponent(); 在这个函数中对WINDOWS控件(System.Windows.Forms.Control)和窗体初始化  执行ResumeLayout(false);ResumeLayout:当调整控件的多个属性时,将先后使用 SuspendLayout 和ResumeLayout 方法取消多个Layout 事件。例如,通常先调用 SuspendLayout 方法,然后设置控件的 Size、Location、Anchor 或 Dock 属性,最后调用 ResumeLayout(bool) 方法以使更改生效。默认是TRUE恢复正常的布局逻辑,FALSE改变布局。  第三:执行后显示窗体,进行程序的运行,等待事件发生,并响应事件。  第四:关闭窗体. exit Application.Run(可能相当于WINDOWS中的消息循环机制)函数, 程序结束.

C# 挂起控件的布局逻辑有什么用

挂起布局逻辑与恢复布局逻辑。有时候,需要重新布置整个窗口里的控件的位置布局,如刚刚初始化时就是一个例子。这样在每增加一个有dock等属性的控件时,由于这些布局都是相对性布局,都需要重新计算位置什么的,并实际执行布局。如果一个窗口上有50个控件,这个布局处理就要执行50次,并触发50 * n次的布局有关的事件。而实际上,在定义布局方案过程中,这些布局是没有必要每个控件定义之后就立即执行布局的,也没有必要处理因此发出的布局事件。更合理的办法,是在全部定义完所有控件的布局方案之后,才一次性计算布局结果,并一次执行。于是,就设计了这两个函数。第一个函数用于暂停实际的布局,而第二个函数用于恢复实际布局。在程序里,如果你需要大规模调整布局方案时,就可以先调用suspendlayout,暂停布局执行,然后定义谁在前,谁在后,谁在上,谁在下,谁填充左,谁填充右。布置完毕。resumelayout,于是,一次性处理完毕。如果注释这两个方法的调用,效果上也不会有什么变化,只是在性能上会造成不必要的开销。 0分。唉。这么复杂的问题,能加点分就加点分吧!

如何用c#做一个秒表

由于目前用到了C#的有关知识,但之前没有C#的基础,所以趁着机会正好学习学习。

本篇博文,记录下利用C#实现一个简单的秒表计时器,基本界面如下图。

功能说明:点击“开始”开始计时,点击“暂停”暂停计时,点击“”停止“”停止计时,再点击“开始”,重新开始计时。

首先,我们在窗体设计窗口画出该界面,由1个Label,3个button构成。双击按钮添加事件。

核心部分是用秒表对象Stopwatch和时钟Timer实现的。

程序源代码如下:

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Diagnostics;namespace Ch04Ex04{public partial class Form1 : Form{public Form1(){InitializeComponent();}Timer time = new Timer();Stopwatch sw; //秒表对象TimeSpan ts;static int count = 1;private void button1_Click(object sender, EventArgs e){//开始按钮button2.Enabled = true;button3.Enabled = true;if(button2.Text == “继续“) //开始后将继续按钮重置为暂停button2.Text = “暂停“;sw = new Stopwatch();time.Tick += new EventHandler(time_Tick);  //时钟触发信号time.Interval = 1;sw.Start();time.Start();}void time_Tick(object sender, EventArgs e){ts = sw.Elapsed;label1.Text = string.Format(“{0}:{1}:{2}:{3}“, ts.Hours, ts.Minutes, ts.Seconds,ts.Milliseconds/10);}private void button3_Click(object sender, EventArgs e){//停止时间按钮sw.Stop();time.Stop();label1.Text = string.Format(“{0}:{1}:{2}:{3}“, 0, 0, 0, 0);}private void Form1_Load(object sender, EventArgs e){button2.Enabled = false;button3.Enabled = false;}private void button2_Click(object sender, EventArgs e){if (button2.Text == “暂停“){//暂停事件按钮button2.Text = “继续“;sw.Stop();time.Stop();}else if (button2.Text == “继续“){//继续事件button2.Text = “暂停“;sw.Start();time.Start();}}}}秒表运行结果如图所示。下一步工作:在左下方添加一个label,实验多次暂停的功能,即能保存秒表的多个中间结果,如记录多名同学的长跑成绩的时候,暂停按钮只是记录到达终点的同学的成绩,计时还在继续,这个功能不难实现,给自己也给各位一个动手的余地。-------------------------------------------------------------------------------------------------------

以下是窗体设计器自动生成的代码,辅助参考。

#region Windows 窗体设计器生成的代码/// 《summary》/// 设计器支持所需的方法 - 不要/// 使用代码编辑器修改此方法的内容。/// 《/summary》private void InitializeComponent(){this.button1 = new System.Windows.Forms.Button();this.button3 = new System.Windows.Forms.Button();this.label1 = new System.Windows.Forms.Label();this.button2 = new System.Windows.Forms.Button();this.SuspendLayout();//// button1//this.button1.Location = new System.Drawing.Point(204, 78);this.button1.Name = “button1“;this.button1.Size = new System.Drawing.Size(38, 23);this.button1.TabIndex = 0;this.button1.Text = “开始“;this.button1.UseVisualStyleBackColor = true;this.button1.Click += new System.EventHandler(this.button1_Click);//// button3//this.button3.Location = new System.Drawing.Point(205, 163);this.button3.Name = “button3“;this.button3.Size = new System.Drawing.Size(37, 23);this.button3.TabIndex = 2;this.button3.Text = “停止“;this.button3.UseVisualStyleBackColor = true;this.button3.Click += new System.EventHandler(this.button3_Click);//// label1//this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));this.label1.Font = new System.Drawing.Font(“宋体“, 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.label1.Location = new System.Drawing.Point(30, 33);this.label1.Name = “label1“;this.label1.Size = new System.Drawing.Size(202, 42);this.label1.TabIndex = 3;this.label1.Text = “0:0:0:0“;//// button2//this.button2.Location = new System.Drawing.Point(205, 122);this.button2.Name = “button2“;this.button2.Size = new System.Drawing.Size(38, 23);this.button2.TabIndex = 4;this.button2.Text = “暂停“;this.button2.UseVisualStyleBackColor = true;this.button2.Click += new System.EventHandler(this.button2_Click);//// Form1//this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(284, 262);this.Controls.Add(this.button2);this.Controls.Add(this.label1);this.Controls.Add(this.button3);this.Controls.Add(this.button1);this.Name = “Form1“;this.RightToLeftLayout = true;this.Text = “秒表“;this.Load += new System.EventHandler(this.Form1_Load);this.ResumeLayout(false);}#endregion

如何让C#程序发声

不知道就这一个行不行,如果不行的话,可以给我发邮件到plmmmmlq@163.com我把整个解决方案都给你using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Diagnostics; using System.Management; using Microsoft.Win32; namespace XKTSys { /// 《summary》 /// frmSplash 的摘要说明。 /// 《/summary》 public class frmSplash : System.Windows.Forms.Form { public const string APP_TITLE=“习考通“; private System.Windows.Forms.PictureBox picHelp; private System.Windows.Forms.PictureBox picExit; private System.Windows.Forms.PictureBox picReview; private System.Windows.Forms.PictureBox picTest; private System.Windows.Forms.PictureBox picExercise; private string strDBPath=““; [DllImport(“winmm.dll“)] public static extern bool PlaySound(string pszSound,int hmod,int fdwSound); public const int SND_FILENAME=0x00020000; public const int SND_ASYNC=0x0001; private frmExercise frmExercise1; private frmTest frmTest1; private frmReview frmReview1; private System.ComponentModel.IContainer components=null; public frmSplash() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); this.strDBPath=Environment.CurrentDirectory; this.Text=APP_TITLE; } /// 《summary》 /// 应用程序的主入口点。 /// 《/summary》 [STAThread] static void Main() { Application.Run(new frmSplash()); } /// 《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() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmSplash)); this.picExercise = new System.Windows.Forms.PictureBox(); this.picReview = new System.Windows.Forms.PictureBox(); this.picTest = new System.Windows.Forms.PictureBox(); this.picExit = new System.Windows.Forms.PictureBox(); this.picHelp = new System.Windows.Forms.PictureBox(); this.SuspendLayout(); // // picExercise // this.picExercise.Cursor = System.Windows.Forms.Cursors.Hand; this.picExercise.Image = ((System.Drawing.Image)(resources.GetObject(“picExercise.Image“))); this.picExercise.Location = new System.Drawing.Point(386, 324); this.picExercise.Name = “picExercise“; this.picExercise.Size = new System.Drawing.Size(134, 30); this.picExercise.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.picExercise.TabIndex = 7; this.picExercise.TabStop = false; this.picExercise.Click += new System.EventHandler(this.picExercise_Click); this.picExercise.MouseEnter += new System.EventHandler(this.picExercise_MouseEnter); this.picExercise.MouseLeave += new System.EventHandler(this.picExercise_MouseLeave); // // picReview // this.picReview.Cursor = System.Windows.Forms.Cursors.Hand; this.picReview.Image = ((System.Drawing.Image)(resources.GetObject(“picReview.Image“))); this.picReview.Location = new System.Drawing.Point(225, 216); this.picReview.Name = “picReview“; this.picReview.Size = new System.Drawing.Size(134, 30); this.picReview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.picReview.TabIndex = 8; this.picReview.TabStop = false; this.picReview.Click += new System.EventHandler(this.picReview_Click); this.picReview.MouseEnter += new System.EventHandler(this.picReview_MouseEnter); this.picReview.MouseLeave += new System.EventHandler(this.picReview_MouseLeave); // // picTest // this.picTest.Cursor = System.Windows.Forms.Cursors.Hand; this.picTest.Image = ((System.Drawing.Image)(resources.GetObject(“picTest.Image“))); this.picTest.Location = new System.Drawing.Point(308, 269); this.picTest.Name = “picTest“; this.picTest.Size = new System.Drawing.Size(134, 30); this.picTest.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.picTest.TabIndex = 9; this.picTest.TabStop = false; this.picTest.Click += new System.EventHandler(this.picTest_Click); this.picTest.MouseEnter += new System.EventHandler(this.picTest_MouseEnter); this.picTest.MouseLeave += new System.EventHandler(this.picTest_MouseLeave); // // picExit // this.picExit.Cursor = System.Windows.Forms.Cursors.Hand; this.picExit.Image = ((System.Drawing.Image)(resources.GetObject(“picExit.Image“))); this.picExit.Location = new System.Drawing.Point(512, 404); this.picExit.Name = “picExit“; this.picExit.Size = new System.Drawing.Size(78, 30); this.picExit.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.picExit.TabIndex = 10; this.picExit.TabStop = false; this.picExit.Click += new System.EventHandler(this.picExit_Click); this.picExit.MouseEnter += new System.EventHandler(this.picExit_MouseEnter); this.picExit.MouseLeave += new System.EventHandler(this.picExit_MouseLeave); // // picHelp // this.picHelp.Cursor = System.Windows.Forms.Cursors.Hand; this.picHelp.Image = ((System.Drawing.Image)(resources.GetObject(“picHelp.Image“))); this.picHelp.Location = new System.Drawing.Point(158, 164); this.picHelp.Name = “picHelp“; this.picHelp.Size = new System.Drawing.Size(134, 30); this.picHelp.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.picHelp.TabIndex = 11; this.picHelp.TabStop = false; this.picHelp.Click += new System.EventHandler(this.picHelp_Click); this.picHelp.MouseEnter += new System.EventHandler(this.picHelp_MouseEnter); this.picHelp.MouseLeave += new System.EventHandler(this.picHelp_MouseLeave); // // frmSplash // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject(“$this.BackgroundImage“))); this.ClientSize = new System.Drawing.Size(602, 447); this.Controls.Add(this.picHelp); this.Controls.Add(this.picReview); this.Controls.Add(this.picExercise); this.Controls.Add(this.picTest); this.Controls.Add(this.picExit); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject(“$this.Icon“))); this.MaximizeBox = false; this.Name = “frmSplash“; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = “习考通 2006“; this.ResumeLayout(false); } #endregion private void frm_Closed(object sender, System.EventArgs e) { this.Show(); } //重点复习 private void picReview_MouseEnter(object sender, System.EventArgs e) { PlaySound(“Sound\\sel.wav“,0,SND_FILENAME|SND_ASYNC); this.picReview.Top=218; } private void picReview_MouseLeave(object sender, System.EventArgs e) { this.picReview.Top=216; } private void picReview_Click(object sender, System.EventArgs e) { this.Cursor=Cursors.WaitCursor; frmReview1=new frmReview(this.strDBPath); frmReview1.Closed+=new EventHandler(frm_Closed); frmReview1.Show(); this.Hide(); this.Cursor=Cursors.Default; } //模拟考试 private void picTest_MouseEnter(object sender, System.EventArgs e) { PlaySound(“Sound\\sel.wav“,0,SND_FILENAME|SND_ASYNC); this.picTest.Top=271; } private void picTest_MouseLeave(object sender, System.EventArgs e) { this.picTest.Top=269; } private void picTest_Click(object sender, System.EventArgs e) { this.Cursor=Cursors.WaitCursor; frmTest1=new frmTest(this.strDBPath); frmTest1.Closed+=new EventHandler(frm_Closed); frmTest1.Show(); this.Hide(); this.Cursor=Cursors.Default; } //集中训练 private void picExercise_MouseEnter(object sender, System.EventArgs e) { PlaySound(“Sound\\sel.wav“,0,SND_FILENAME|SND_ASYNC); this.picExercise.Top=326; } private void picExercise_MouseLeave(object sender, System.EventArgs e) { this.picExercise.Top=324; } private void picExercise_Click(object sender, System.EventArgs e) { this.Cursor=Cursors.WaitCursor; frmExercise1=new frmExercise(this.strDBPath); frmExercise1.Closed+=new EventHandler(frm_Closed); frmExercise1.Show(); this.Hide(); this.Cursor=Cursors.Default; } //使用说明 private void picHelp_Click(object sender, System.EventArgs e) { try { this.Cursor=Cursors.WaitCursor; System.Diagnostics.Process.Start(“readme.txt“); this.Cursor=Cursors.Default; } catch(Exception ex) { MessageBox.Show(ex.Message,APP_TITLE,MessageBoxButtons.OK,MessageBoxIcon.Error); } } private void picHelp_MouseEnter(object sender, System.EventArgs e) { PlaySound(“Sound\\sel.wav“,0,SND_FILENAME|SND_ASYNC); this.picHelp.Top=166; } private void picHelp_MouseLeave(object sender, System.EventArgs e) { this.picHelp.Top=164; } //退出系统 private void picExit_MouseEnter(object sender, System.EventArgs e) { PlaySound(“Sound\\sel.wav“,0,SND_FILENAME|SND_ASYNC); this.picExit.Top=406; } private void picExit_MouseLeave(object sender, System.EventArgs e) { this.picExit.Top=404; } private void picExit_Click(object sender, System.EventArgs e) { this.Close(); } } }


声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,谢谢。

上一篇: thinkphp与php的区别(织梦建站、phpcms建站、thinkphp有什么区别)

下一篇: 17.3关于 性女主(性版17女主角)



推荐阅读