Keyboard Reading

This commit is contained in:
Serge
2023-05-20 20:50:58 +02:00
parent 1ac0f2be08
commit 6adb2e2fcf
7 changed files with 185 additions and 33 deletions

View File

@@ -1,4 +1,5 @@
using System.Drawing.Drawing2D;
using System.Diagnostics;
using System.Drawing.Drawing2D;
using OSD;
@@ -41,12 +42,19 @@ namespace GHelper
}
}
class ToastForm : OSDNativeForm
public class ToastForm : OSDNativeForm
{
protected static string toastText = "Balanced";
protected static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
public ToastForm()
{
timer.Tick += timer_Tick;
timer.Enabled = false;
timer.Interval = 2000;
}
protected override void PerformPaint(PaintEventArgs e)
{
Brush brush = new SolidBrush(Color.FromArgb(150,Color.Black));
@@ -65,6 +73,7 @@ namespace GHelper
public void RunToast(string text)
{
Hide();
toastText = text;
Screen screen1 = Screen.FromHandle(base.Handle);
@@ -76,18 +85,13 @@ namespace GHelper
Show();
timer.Stop();
timer.Tick -= timer_Tick;
timer.Tick += timer_Tick;
timer.Enabled = true;
timer.Interval = 2000;
timer.Start();
}
private void timer_Tick(object? sender, EventArgs e)
{
timer.Stop();
Debug.WriteLine("Toast end");
timer.Enabled = false;
Hide();
}
}