SpeedDialog.cs
上传用户:sflyled
上传日期:2013-01-18
资源大小:1760k
文件大小:5k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. namespace BrickOut
  7. {
  8. /// <summary>
  9. /// Summary description for SpeedDialog.
  10. /// </summary>
  11. public class SpeedDialog : System.Windows.Forms.Form
  12. {
  13.         private System.Windows.Forms.GroupBox groupBox1;
  14.         private System.Windows.Forms.RadioButton SlowRadio;
  15.         private System.Windows.Forms.RadioButton MediumRadio;
  16.         private System.Windows.Forms.RadioButton FastRadio;
  17.         private System.Windows.Forms.Button button1;
  18. /// <summary>
  19. /// Required designer variable.
  20. /// </summary>
  21. private System.ComponentModel.Container components = null;
  22.         public int Speed = 250;
  23. public SpeedDialog()
  24. {
  25. //
  26. // Required for Windows Form Designer support
  27. //
  28. InitializeComponent();
  29. //
  30. // TODO: Add any constructor code after InitializeComponent call
  31. //
  32. }
  33. /// <summary>
  34. /// Clean up any resources being used.
  35. /// </summary>
  36. protected override void Dispose( bool disposing )
  37. {
  38. if( disposing )
  39. {
  40. if(components != null)
  41. {
  42. components.Dispose();
  43. }
  44. }
  45. base.Dispose( disposing );
  46. }
  47. #region Windows Form Designer generated code
  48. /// <summary>
  49. /// Required method for Designer support - do not modify
  50. /// the contents of this method with the code editor.
  51. /// </summary>
  52. private void InitializeComponent()
  53. {
  54.             this.groupBox1 = new System.Windows.Forms.GroupBox();
  55.             this.SlowRadio = new System.Windows.Forms.RadioButton();
  56.             this.MediumRadio = new System.Windows.Forms.RadioButton();
  57.             this.FastRadio = new System.Windows.Forms.RadioButton();
  58.             this.button1 = new System.Windows.Forms.Button();
  59.             this.groupBox1.SuspendLayout();
  60.             this.SuspendLayout();
  61.             // 
  62.             // groupBox1
  63.             // 
  64.             this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
  65.                                                                                     this.FastRadio,
  66.                                                                                     this.MediumRadio,
  67.                                                                                     this.SlowRadio});
  68.             this.groupBox1.Location = new System.Drawing.Point(16, 8);
  69.             this.groupBox1.Name = "groupBox1";
  70.             this.groupBox1.Size = new System.Drawing.Size(112, 112);
  71.             this.groupBox1.TabIndex = 0;
  72.             this.groupBox1.TabStop = false;
  73.             this.groupBox1.Text = "Speed";
  74.             // 
  75.             // SlowRadio
  76.             // 
  77.             this.SlowRadio.Checked = true;
  78.             this.SlowRadio.Location = new System.Drawing.Point(16, 24);
  79.             this.SlowRadio.Name = "SlowRadio";
  80.             this.SlowRadio.Size = new System.Drawing.Size(88, 24);
  81.             this.SlowRadio.TabIndex = 0;
  82.             this.SlowRadio.TabStop = true;
  83.             this.SlowRadio.Text = "Slow";
  84.             this.SlowRadio.CheckedChanged += new System.EventHandler(this.SlowRadio_CheckedChanged);
  85.             // 
  86.             // MediumRadio
  87.             // 
  88.             this.MediumRadio.Location = new System.Drawing.Point(16, 52);
  89.             this.MediumRadio.Name = "MediumRadio";
  90.             this.MediumRadio.Size = new System.Drawing.Size(88, 24);
  91.             this.MediumRadio.TabIndex = 1;
  92.             this.MediumRadio.Text = "Medium";
  93.             // 
  94.             // FastRadio
  95.             // 
  96.             this.FastRadio.Location = new System.Drawing.Point(16, 80);
  97.             this.FastRadio.Name = "FastRadio";
  98.             this.FastRadio.Size = new System.Drawing.Size(88, 24);
  99.             this.FastRadio.TabIndex = 2;
  100.             this.FastRadio.Text = "Fast";
  101.             // 
  102.             // button1
  103.             // 
  104.             this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
  105.             this.button1.Location = new System.Drawing.Point(38, 128);
  106.             this.button1.Name = "button1";
  107.             this.button1.Size = new System.Drawing.Size(72, 24);
  108.             this.button1.TabIndex = 1;
  109.             this.button1.Text = "OK";
  110.             this.button1.Click += new System.EventHandler(this.button1_Click);
  111.             // 
  112.             // SpeedDialog
  113.             // 
  114.             this.AcceptButton = this.button1;
  115.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  116.             this.ClientSize = new System.Drawing.Size(144, 157);
  117.             this.Controls.AddRange(new System.Windows.Forms.Control[] {
  118.                                                                           this.button1,
  119.                                                                           this.groupBox1});
  120.             this.Name = "SpeedDialog";
  121.             this.Text = "Level";
  122.             this.groupBox1.ResumeLayout(false);
  123.             this.ResumeLayout(false);
  124.         }
  125. #endregion
  126.         private void SlowRadio_CheckedChanged(object sender, System.EventArgs e)
  127.         {
  128.         }
  129.         private void button1_Click(object sender, System.EventArgs e)
  130.         {
  131.             if (SlowRadio.Checked)
  132.                 Speed = 100;
  133.             else if (MediumRadio.Checked)
  134.                 Speed = 100;
  135.             else
  136.                 Speed = 50;
  137.         }
  138. }
  139. }