UpdateInterval can now be changed while the plugin is running and updated the Icon.

This commit is contained in:
Stone-Red-Code
2021-08-21 22:09:42 +02:00
parent d4c4b4e1ed
commit 8e31735032
13 changed files with 57 additions and 20 deletions
+24 -3
View File
@@ -2,6 +2,8 @@
using DesktopMagicPluginAPI.Inputs;
using DesktopMagicPluginAPI.Drawing;
using System.Drawing;
using System.Diagnostics;
using System.Drawing.Drawing2D;
namespace DesktopMagicPlugin.Test
{
@@ -12,6 +14,8 @@ namespace DesktopMagicPlugin.Test
[Element("Text:")] //Mark the property as element with the specified description
private TextBox textBox = new TextBox("abc"); //Create a text box with the specified default value.
private Color color = Color.Black;
public InputExamplePlugin()
{
textBox.OnValueChanged += TextBox_OnValueChanged; //Add an event handler to the "OnValueChanged" event.
@@ -19,7 +23,23 @@ namespace DesktopMagicPlugin.Test
private void TextBox_OnValueChanged()
{
Application.UpdateWindow(); //Update the pugin window. (Calls the "Main" method.)
Application.UpdateWindow(); //Update the plugin window. (Calls the "Main" method.)
}
public override void OnMouseMove(Point position)
{
Debug.WriteLine(position.X);
Debug.WriteLine(500);
if (500 < position.X && color == Color.Black)
{
color = Color.White;
Application.UpdateWindow();
}
else if (500 > position.X && color == Color.White)
{
color = Color.Black;
Application.UpdateWindow();
}
}
public override Bitmap Main()
@@ -28,8 +48,9 @@ namespace DesktopMagicPlugin.Test
using (Graphics g = Graphics.FromImage(bmp))
{
g.Clear(Application.Color); //Set the background color to the color specified in the Desktop Magic application.
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.Clear(color);
g.DrawStringFixedWidth(textBox.Value, new Font(Application.Font, 100), Brushes.Black, new PointF(0, 0), 120); //Draw the value of the text box to the image.
}