Actually implement the Start method correctly

This commit is contained in:
Stone-Red-Code
2021-08-22 12:50:28 +02:00
parent 3268a66d64
commit ae490367ee
2 changed files with 17 additions and 16 deletions
+16 -16
View File
@@ -16,11 +16,26 @@ namespace DesktopMagicPlugin.Test
private Color color = Color.Black;
public InputExamplePlugin()
public override void Start()
{
textBox.OnValueChanged += TextBox_OnValueChanged; //Add an event handler to the "OnValueChanged" event.
}
public override Bitmap Main()
{
Bitmap bmp = new Bitmap(1000, 1000);
using (Graphics g = Graphics.FromImage(bmp))
{
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.
}
return bmp; //Return the image.
}
private void TextBox_OnValueChanged()
{
Application.UpdateWindow(); //Update the plugin window. (Calls the "Main" method.)
@@ -41,20 +56,5 @@ namespace DesktopMagicPlugin.Test
Application.UpdateWindow();
}
}
public override Bitmap Main()
{
Bitmap bmp = new Bitmap(1000, 1000);
using (Graphics g = Graphics.FromImage(bmp))
{
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.
}
return bmp; //Return the image.
}
}
}