PlayIntervalSettingDialog.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using Resources;
  2. using SmartCoalApplication.Core;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace SmartCoalApplication.AutomaticMeasurement
  13. {
  14. /// <summary>
  15. /// 播放器间隔
  16. /// </summary>
  17. public partial class PlayIntervalSettingDialog : PdnBaseForm
  18. {
  19. private Label label1;
  20. public TextBox textBox1;
  21. private Label label2;
  22. public Button button1;
  23. private Button button2;
  24. public PlayIntervalSettingDialog()
  25. {
  26. InitializeComponent();
  27. this.label1.Text = PdnResources.GetString("Menu.Timedelay.Text") + ":";
  28. this.button1.Text = PdnResources.GetString("Menu.confirm.Text");
  29. this.button2.Text = PdnResources.GetString("Menu.cancel.text");
  30. this.Text = PdnResources.GetString("Menu.Playerinterval.Text");
  31. }
  32. private void InitializeComponent()
  33. {
  34. this.label1 = new System.Windows.Forms.Label();
  35. this.textBox1 = new System.Windows.Forms.TextBox();
  36. this.label2 = new System.Windows.Forms.Label();
  37. this.button1 = new System.Windows.Forms.Button();
  38. this.button2 = new System.Windows.Forms.Button();
  39. this.SuspendLayout();
  40. //
  41. // label1
  42. //
  43. this.label1.AutoSize = true;
  44. this.label1.Location = new System.Drawing.Point(33, 30);
  45. this.label1.Name = "label1";
  46. this.label1.Size = new System.Drawing.Size(41, 12);
  47. this.label1.TabIndex = 0;
  48. this.label1.Text = "延时:";
  49. //
  50. // textBox1
  51. //
  52. this.textBox1.Location = new System.Drawing.Point(80, 26);
  53. this.textBox1.Name = "textBox1";
  54. this.textBox1.Size = new System.Drawing.Size(81, 21);
  55. this.textBox1.TabIndex = 1;
  56. this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
  57. //
  58. // label2
  59. //
  60. this.label2.AutoSize = true;
  61. this.label2.Location = new System.Drawing.Point(167, 30);
  62. this.label2.Name = "label2";
  63. this.label2.Size = new System.Drawing.Size(17, 12);
  64. this.label2.TabIndex = 2;
  65. this.label2.Text = "ms";
  66. //
  67. // button1
  68. //
  69. this.button1.Location = new System.Drawing.Point(272, 24);
  70. this.button1.Name = "button1";
  71. this.button1.Size = new System.Drawing.Size(75, 23);
  72. this.button1.TabIndex = 3;
  73. this.button1.Text = "确认";
  74. this.button1.UseVisualStyleBackColor = true;
  75. //
  76. // button2
  77. //
  78. this.button2.Location = new System.Drawing.Point(272, 65);
  79. this.button2.Name = "button2";
  80. this.button2.Size = new System.Drawing.Size(75, 23);
  81. this.button2.TabIndex = 4;
  82. this.button2.Text = "取消";
  83. this.button2.UseVisualStyleBackColor = true;
  84. this.button2.Click += new System.EventHandler(this.button2_Click);
  85. //
  86. // PlayIntervalSettingDialog
  87. //
  88. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  89. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
  90. this.ClientSize = new System.Drawing.Size(372, 110);
  91. this.Controls.Add(this.button2);
  92. this.Controls.Add(this.button1);
  93. this.Controls.Add(this.label2);
  94. this.Controls.Add(this.textBox1);
  95. this.Controls.Add(this.label1);
  96. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  97. this.MaximizeBox = false;
  98. this.MinimizeBox = false;
  99. this.Name = "PlayIntervalSettingDialog";
  100. this.Text = "播放器间隔";
  101. this.Controls.SetChildIndex(this.label1, 0);
  102. this.Controls.SetChildIndex(this.textBox1, 0);
  103. this.Controls.SetChildIndex(this.label2, 0);
  104. this.Controls.SetChildIndex(this.button1, 0);
  105. this.Controls.SetChildIndex(this.button2, 0);
  106. this.ResumeLayout(false);
  107. this.PerformLayout();
  108. }
  109. private void setLanguege()
  110. {
  111. this.label1.Text = PdnResources.GetString("PlayIntervalSettingDialog.label1"); // 延时
  112. this.button1.Text = PdnResources.GetString("PlayIntervalSettingDialog.button1"); // 确认
  113. this.button2.Text = PdnResources.GetString("PlayIntervalSettingDialog.button2"); // 取消
  114. }
  115. /// <summary>
  116. /// 取消按钮
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void button2_Click(object sender, EventArgs e)
  121. {
  122. this.Close();
  123. }
  124. /// <summary>
  125. /// 限制只可以输入0-9数字以及退格键
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  130. {
  131. if (e.KeyChar != '\b')//这是允许输入退格键 
  132.             {
  133. int len = this.textBox1.Text.Length;
  134. if (len < 1 && e.KeyChar == '0')
  135. {
  136. e.Handled = true;
  137. }
  138. else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字 
  139.                 {
  140. e.Handled = true;
  141. }
  142. }
  143. }
  144. }
  145. }