mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 17:06:12 +02:00
UpdateInterval can now be changed while the plugin is running and updated the Icon.
This commit is contained in:
@@ -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.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user