mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 00:46:12 +02:00
Actually implement the Start method correctly
This commit is contained in:
@@ -204,6 +204,7 @@ namespace DesktopMagic
|
||||
valueTimer.Interval = 1000;
|
||||
valueTimer.Elapsed += ValueTimer_Elapsed;
|
||||
|
||||
pluginClassInstance.Start();
|
||||
UpdatePluginWindow();
|
||||
|
||||
if (pluginClassInstance.UpdateInterval > 0)
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user