123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace PaintDotNet
- {
- /// <summary>
- /// 播放器间隔
- /// </summary>
- public partial class PlayIntervalSettingDialog : PdnBaseForm
- {
- private Label label1;
- public TextBox textBox1;
- private Label label2;
- public Button button1;
- private Button button2;
- public PlayIntervalSettingDialog()
- {
- InitializeComponent();
- this.label1.Text = PdnResources.GetString("Menu.Timedelay.Text") + ":";
- this.button1.Text = PdnResources.GetString("Menu.confirm.Text");
- this.button2.Text = PdnResources.GetString("Menu.cancel.text");
- this.Text = PdnResources.GetString("Menu.Playerinterval.Text");
- }
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(33, 30);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(41, 12);
- this.label1.TabIndex = 0;
- this.label1.Text = "延时:";
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(80, 26);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(81, 21);
- this.textBox1.TabIndex = 1;
- this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(167, 30);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(17, 12);
- this.label2.TabIndex = 2;
- this.label2.Text = "ms";
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(272, 24);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 3;
- this.button1.Text = "确认";
- this.button1.UseVisualStyleBackColor = true;
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(272, 65);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 4;
- this.button2.Text = "取消";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // PlayIntervalSettingDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.ClientSize = new System.Drawing.Size(372, 110);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.textBox1);
- this.Controls.Add(this.label1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "PlayIntervalSettingDialog";
- this.Text = "播放器间隔";
- this.Controls.SetChildIndex(this.label1, 0);
- this.Controls.SetChildIndex(this.textBox1, 0);
- this.Controls.SetChildIndex(this.label2, 0);
- this.Controls.SetChildIndex(this.button1, 0);
- this.Controls.SetChildIndex(this.button2, 0);
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- /// <summary>
- /// 取消按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 限制只可以输入0-9数字以及退格键
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar != '\b')//这是允许输入退格键
- {
- int len = this.textBox1.Text.Length;
- if (len < 1 && e.KeyChar == '0')
- {
- e.Handled = true;
- }
- else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字
- {
- e.Handled = true;
- }
- }
- }
- }
- }
|