mirror of
https://github.com/JDM170/fast_typing
synced 2025-12-10 05:57:22 +07:00
Фиксы, добавление трекбара для регулировки скорости
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
51
Form1.Designer.cs
generated
51
Form1.Designer.cs
generated
@@ -43,7 +43,7 @@
|
|||||||
//
|
//
|
||||||
// btn_start
|
// btn_start
|
||||||
//
|
//
|
||||||
this.btn_start.Location = new System.Drawing.Point(30, 26);
|
this.btn_start.Location = new System.Drawing.Point(81, 130);
|
||||||
this.btn_start.Name = "btn_start";
|
this.btn_start.Name = "btn_start";
|
||||||
this.btn_start.Size = new System.Drawing.Size(75, 23);
|
this.btn_start.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btn_start.TabIndex = 0;
|
this.btn_start.TabIndex = 0;
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
//
|
//
|
||||||
// btn_stop
|
// btn_stop
|
||||||
//
|
//
|
||||||
this.btn_stop.Location = new System.Drawing.Point(136, 26);
|
this.btn_stop.Location = new System.Drawing.Point(179, 130);
|
||||||
this.btn_stop.Name = "btn_stop";
|
this.btn_stop.Name = "btn_stop";
|
||||||
this.btn_stop.Size = new System.Drawing.Size(75, 23);
|
this.btn_stop.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btn_stop.TabIndex = 1;
|
this.btn_stop.TabIndex = 1;
|
||||||
@@ -64,9 +64,9 @@
|
|||||||
// textBox1
|
// textBox1
|
||||||
//
|
//
|
||||||
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
this.textBox1.Location = new System.Drawing.Point(30, 67);
|
this.textBox1.Location = new System.Drawing.Point(12, 12);
|
||||||
this.textBox1.Name = "textBox1";
|
this.textBox1.Name = "textBox1";
|
||||||
this.textBox1.Size = new System.Drawing.Size(306, 31);
|
this.textBox1.Size = new System.Drawing.Size(305, 31);
|
||||||
this.textBox1.TabIndex = 2;
|
this.textBox1.TabIndex = 2;
|
||||||
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||||
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
|
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
|
||||||
@@ -74,9 +74,10 @@
|
|||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(30, 120);
|
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
|
this.label1.Location = new System.Drawing.Point(12, 64);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
this.label1.Size = new System.Drawing.Size(91, 18);
|
||||||
this.label1.TabIndex = 3;
|
this.label1.TabIndex = 3;
|
||||||
this.label1.Text = "Пройдено:";
|
this.label1.Text = "Пройдено:";
|
||||||
//
|
//
|
||||||
@@ -84,63 +85,66 @@
|
|||||||
//
|
//
|
||||||
this.lbl_pass_count.AutoSize = true;
|
this.lbl_pass_count.AutoSize = true;
|
||||||
this.lbl_pass_count.BackColor = System.Drawing.SystemColors.Control;
|
this.lbl_pass_count.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.lbl_pass_count.Location = new System.Drawing.Point(92, 120);
|
this.lbl_pass_count.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
|
this.lbl_pass_count.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
|
||||||
|
this.lbl_pass_count.Location = new System.Drawing.Point(107, 64);
|
||||||
this.lbl_pass_count.Name = "lbl_pass_count";
|
this.lbl_pass_count.Name = "lbl_pass_count";
|
||||||
this.lbl_pass_count.Size = new System.Drawing.Size(13, 13);
|
this.lbl_pass_count.Size = new System.Drawing.Size(17, 18);
|
||||||
this.lbl_pass_count.TabIndex = 4;
|
this.lbl_pass_count.TabIndex = 4;
|
||||||
this.lbl_pass_count.Text = "0";
|
this.lbl_pass_count.Text = "0";
|
||||||
//
|
//
|
||||||
// label3
|
// label3
|
||||||
//
|
//
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Location = new System.Drawing.Point(30, 158);
|
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
|
this.label3.Location = new System.Drawing.Point(12, 92);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(50, 13);
|
this.label3.Size = new System.Drawing.Size(76, 18);
|
||||||
this.label3.TabIndex = 5;
|
this.label3.TabIndex = 5;
|
||||||
this.label3.Text = "Ошибок:";
|
this.label3.Text = "Ошибок:";
|
||||||
//
|
//
|
||||||
// lbl_err_count
|
// lbl_err_count
|
||||||
//
|
//
|
||||||
this.lbl_err_count.AutoSize = true;
|
this.lbl_err_count.AutoSize = true;
|
||||||
this.lbl_err_count.Location = new System.Drawing.Point(92, 158);
|
this.lbl_err_count.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
|
this.lbl_err_count.ForeColor = System.Drawing.Color.Red;
|
||||||
|
this.lbl_err_count.Location = new System.Drawing.Point(107, 91);
|
||||||
this.lbl_err_count.Name = "lbl_err_count";
|
this.lbl_err_count.Name = "lbl_err_count";
|
||||||
this.lbl_err_count.Size = new System.Drawing.Size(13, 13);
|
this.lbl_err_count.Size = new System.Drawing.Size(17, 18);
|
||||||
this.lbl_err_count.TabIndex = 6;
|
this.lbl_err_count.TabIndex = 6;
|
||||||
this.lbl_err_count.Text = "0";
|
this.lbl_err_count.Text = "0";
|
||||||
//
|
//
|
||||||
// trackBar1
|
// trackBar1
|
||||||
//
|
//
|
||||||
this.trackBar1.Location = new System.Drawing.Point(179, 126);
|
this.trackBar1.Location = new System.Drawing.Point(153, 64);
|
||||||
this.trackBar1.Name = "trackBar1";
|
this.trackBar1.Name = "trackBar1";
|
||||||
this.trackBar1.Size = new System.Drawing.Size(157, 45);
|
this.trackBar1.Size = new System.Drawing.Size(157, 45);
|
||||||
this.trackBar1.TabIndex = 7;
|
this.trackBar1.TabIndex = 7;
|
||||||
this.trackBar1.Visible = false;
|
this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(161, 158);
|
this.label2.Location = new System.Drawing.Point(140, 96);
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(63, 13);
|
this.label2.Size = new System.Drawing.Size(50, 13);
|
||||||
this.label2.TabIndex = 8;
|
this.label2.TabIndex = 8;
|
||||||
this.label2.Text = "медленнее";
|
this.label2.Text = "быстрее";
|
||||||
this.label2.Visible = false;
|
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
this.label4.AutoSize = true;
|
this.label4.AutoSize = true;
|
||||||
this.label4.Location = new System.Drawing.Point(298, 158);
|
this.label4.Location = new System.Drawing.Point(265, 96);
|
||||||
this.label4.Name = "label4";
|
this.label4.Name = "label4";
|
||||||
this.label4.Size = new System.Drawing.Size(50, 13);
|
this.label4.Size = new System.Drawing.Size(63, 13);
|
||||||
this.label4.TabIndex = 9;
|
this.label4.TabIndex = 9;
|
||||||
this.label4.Text = "быстрее";
|
this.label4.Text = "медленнее";
|
||||||
this.label4.Visible = false;
|
|
||||||
//
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(370, 204);
|
this.ClientSize = new System.Drawing.Size(334, 162);
|
||||||
this.Controls.Add(this.label4);
|
this.Controls.Add(this.label4);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.trackBar1);
|
this.Controls.Add(this.trackBar1);
|
||||||
@@ -153,6 +157,7 @@
|
|||||||
this.Controls.Add(this.btn_start);
|
this.Controls.Add(this.btn_start);
|
||||||
this.Name = "Form1";
|
this.Name = "Form1";
|
||||||
this.Text = "Учимся печатать быстро";
|
this.Text = "Учимся печатать быстро";
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|||||||
47
Form1.cs
47
Form1.cs
@@ -1,12 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
/*using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;*/
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
|
||||||
@@ -14,8 +6,7 @@ namespace WindowsFormsApp1
|
|||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
static int timerStart = 2000;
|
int timerInterval = 2000;
|
||||||
string str = "";
|
|
||||||
int lastSymbol = 0;
|
int lastSymbol = 0;
|
||||||
int pass_count = 0;
|
int pass_count = 0;
|
||||||
int err_count = 0;
|
int err_count = 0;
|
||||||
@@ -27,14 +18,18 @@ namespace WindowsFormsApp1
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void timerCallback(object sender, EventArgs ea)
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
timer.Tick += new EventHandler(timerCallback);
|
||||||
|
trackBar1.Maximum = timerInterval;
|
||||||
|
trackBar1.Minimum = timerInterval - 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timerCallback(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
lastSymbol = rnd.Next(1072, 1103);
|
lastSymbol = rnd.Next(1072, 1103);
|
||||||
if (str.Length < 10)
|
if (textBox1.Text.Length < 10)
|
||||||
{
|
textBox1.Text += (char)lastSymbol;
|
||||||
str += (char)lastSymbol;
|
|
||||||
textBox1.Text = str;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
@@ -44,19 +39,20 @@ namespace WindowsFormsApp1
|
|||||||
|
|
||||||
private void btn_start_Click(object sender, EventArgs e)
|
private void btn_start_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (timer.Enabled) return;
|
||||||
pass_count = 0;
|
pass_count = 0;
|
||||||
err_count = 0;
|
err_count = 0;
|
||||||
|
textBox1.Text = "";
|
||||||
lbl_pass_count.Text = pass_count.ToString();
|
lbl_pass_count.Text = pass_count.ToString();
|
||||||
lbl_err_count.Text = err_count.ToString();
|
lbl_err_count.Text = err_count.ToString();
|
||||||
timer.Interval = timerStart;
|
timer.Interval = timerInterval;
|
||||||
timer.Tick += new EventHandler(timerCallback);
|
|
||||||
timer.Start();
|
|
||||||
textBox1.Focus();
|
textBox1.Focus();
|
||||||
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btn_stop_Click(object sender, EventArgs e)
|
private void btn_stop_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(timer.Enabled) timer.Stop();
|
if (timer.Enabled) timer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
|
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
@@ -66,9 +62,9 @@ namespace WindowsFormsApp1
|
|||||||
{
|
{
|
||||||
if (e.KeyChar == lastSymbol)
|
if (e.KeyChar == lastSymbol)
|
||||||
{
|
{
|
||||||
str = str.Substring(0, str.Length - 1);
|
string text = textBox1.Text;
|
||||||
|
textBox1.Text = text.Substring(0, text.Length - 1);
|
||||||
pass_count++;
|
pass_count++;
|
||||||
textBox1.Text = str;
|
|
||||||
lbl_pass_count.Text = pass_count.ToString();
|
lbl_pass_count.Text = pass_count.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -79,10 +75,9 @@ namespace WindowsFormsApp1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private void trackBar1_ValueChanged(object sender, EventArgs e)
|
private void trackBar1_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
textBox2.Clear();
|
timerInterval = trackBar1.Value;
|
||||||
textBox2.Text += trackBar1.Value.ToString();
|
}
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.4.33103.184
|
VisualStudioVersion = 17.4.33103.184
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp1", "WindowsFormsApp1.csproj", "{5F9DE337-1610-4FC7-AA64-A27F19DE5819}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fast_typing", "fast_typing.csproj", "{5F9DE337-1610-4FC7-AA64-A27F19DE5819}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Reference in New Issue
Block a user