Revert "Fix mistake"

This reverts commit e89b2981e7.
This commit is contained in:
Stone-Red-Code
2021-08-14 21:42:06 +02:00
parent e89b2981e7
commit 1e57ec1b6a
172 changed files with 2328 additions and 780 deletions
+50 -7
View File
@@ -1,4 +1,5 @@
using DesktopMagicPluginAPI;
using DesktopMagicPluginAPI.Inputs;
using System;
using System.Diagnostics;
using System.Drawing;
@@ -7,17 +8,59 @@ namespace DesktopMagicPlugin.Test
{
public class PluginScript : Plugin
{
public override Bitmap Main()
[Element]
private Label heading = new Label("Heading", true);
[Element]
private Label label = new Label("");
[Element("Slider:")]
private Slider slider = new Slider(1, 23, 4);
[Element("Text:")]
private TextBox textBox = new TextBox("abc");
[Element]
private Button button = new Button("Press me!");
public override int UpdateInterval { get; set; }
public PluginScript()
{
Bitmap bmp = new Bitmap(100, 100);
using Graphics g = Graphics.FromImage(bmp);
g.Clear(Application.Color);
return bmp;
slider.OnValueChanged += Slider_OnValueChanged;
textBox.OnValueChanged += TextBox_OnValueChanged;
button.OnClick += Button_OnClick; ;
}
public override void OnMouseClick(Point position)
private void Button_OnClick()
{
Debug.WriteLine(position);
Debug.WriteLine("Button pressed");
Application.UpdateWindow();
}
private void TextBox_OnValueChanged()
{
Debug.WriteLine("TextBox value changed:" + textBox.Value);
}
private void Slider_OnValueChanged()
{
Debug.WriteLine("Slider value changed:" + slider.Value);
}
public override Bitmap Main()
{
string str = $"{textBox.Value}: {slider.Value}";
Bitmap bmp = new Bitmap(1000, 1000);
using Graphics g = Graphics.FromImage(bmp);
g.Clear(Application.Color);
g.DrawString(str, new Font(Application.Font, 100), Brushes.Black, new PointF(0, 0));
label.Value = str;
slider.Value++;
return bmp;
}
}
}