mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
- Add Margin option
- Add `Margin` property to `ITheme` - Add `Stop` method to the `Plugin` API - Add `DrawStringNoLeftPadding` and `MeasureStringNoLeftPadding` to `GraphicsExtentions` - Convert most inbuilt components to plugins. - Minor code improvements
This commit is contained in:
@@ -23,6 +23,9 @@
|
||||
- [DrawStringFixedWidth(graphics,s,font,brush,point,width)](#M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringFixedWidth-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Drawing-PointF,System-Single- 'DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringFixedWidth(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF,System.Single)')
|
||||
- [DrawStringMonospace(graphics,s,font,brush,x,y)](#M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringMonospace-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Single,System-Single- 'DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringMonospace(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single)')
|
||||
- [DrawStringMonospace(graphics,s,font,brush,point)](#M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringMonospace-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Drawing-PointF- 'DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringMonospace(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF)')
|
||||
- [DrawStringNoLeftPadding(graphics,s,font,brush,x,y)](#M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringNoLeftPadding-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Single,System-Single- 'DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringNoLeftPadding(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single)')
|
||||
- [DrawStringNoLeftPadding(graphics,s,font,brush,point)](#M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringNoLeftPadding-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Drawing-PointF- 'DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringNoLeftPadding(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF)')
|
||||
- [MeasureStringNoLeftPadding(graphics,text,font)](#M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-MeasureStringNoLeftPadding-System-Drawing-Graphics,System-String,System-Drawing-Font- 'DesktopMagicPluginAPI.Drawing.GraphicsExtentions.MeasureStringNoLeftPadding(System.Drawing.Graphics,System.String,System.Drawing.Font)')
|
||||
- [IPluginData](#T-DesktopMagicPluginAPI-IPluginData 'DesktopMagicPluginAPI.IPluginData')
|
||||
- [Color](#P-DesktopMagicPluginAPI-IPluginData-Color 'DesktopMagicPluginAPI.IPluginData.Color')
|
||||
- [Font](#P-DesktopMagicPluginAPI-IPluginData-Font 'DesktopMagicPluginAPI.IPluginData.Font')
|
||||
@@ -36,6 +39,7 @@
|
||||
- [BackgroundColor](#P-DesktopMagicPluginAPI-ITheme-BackgroundColor 'DesktopMagicPluginAPI.ITheme.BackgroundColor')
|
||||
- [CornerRadius](#P-DesktopMagicPluginAPI-ITheme-CornerRadius 'DesktopMagicPluginAPI.ITheme.CornerRadius')
|
||||
- [Font](#P-DesktopMagicPluginAPI-ITheme-Font 'DesktopMagicPluginAPI.ITheme.Font')
|
||||
- [Margin](#P-DesktopMagicPluginAPI-ITheme-Margin 'DesktopMagicPluginAPI.ITheme.Margin')
|
||||
- [PrimaryColor](#P-DesktopMagicPluginAPI-ITheme-PrimaryColor 'DesktopMagicPluginAPI.ITheme.PrimaryColor')
|
||||
- [SecondaryColor](#P-DesktopMagicPluginAPI-ITheme-SecondaryColor 'DesktopMagicPluginAPI.ITheme.SecondaryColor')
|
||||
- [IntegerUpDown](#T-DesktopMagicPluginAPI-Inputs-IntegerUpDown 'DesktopMagicPluginAPI.Inputs.IntegerUpDown')
|
||||
@@ -60,6 +64,7 @@
|
||||
- [OnMouseMove(position)](#M-DesktopMagicPluginAPI-Plugin-OnMouseMove-System-Drawing-Point- 'DesktopMagicPluginAPI.Plugin.OnMouseMove(System.Drawing.Point)')
|
||||
- [OnMouseWheel(position,delta)](#M-DesktopMagicPluginAPI-Plugin-OnMouseWheel-System-Drawing-Point,System-Int32- 'DesktopMagicPluginAPI.Plugin.OnMouseWheel(System.Drawing.Point,System.Int32)')
|
||||
- [Start()](#M-DesktopMagicPluginAPI-Plugin-Start 'DesktopMagicPluginAPI.Plugin.Start')
|
||||
- [Stop()](#M-DesktopMagicPluginAPI-Plugin-Stop 'DesktopMagicPluginAPI.Plugin.Stop')
|
||||
- [RenderQuality](#T-DesktopMagicPluginAPI-Drawing-RenderQuality 'DesktopMagicPluginAPI.Drawing.RenderQuality')
|
||||
- [High](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-High 'DesktopMagicPluginAPI.Drawing.RenderQuality.High')
|
||||
- [Low](#F-DesktopMagicPluginAPI-Drawing-RenderQuality-Low 'DesktopMagicPluginAPI.Drawing.RenderQuality.Low')
|
||||
@@ -240,14 +245,14 @@ DesktopMagicPluginAPI.Drawing
|
||||
|
||||
##### Summary
|
||||
|
||||
Extentions for the [Graphics](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Graphics 'System.Drawing.Graphics') class.
|
||||
Extensions for the [Graphics](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Graphics 'System.Drawing.Graphics') class.
|
||||
|
||||
<a name='M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringFixedWidth-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Single,System-Single,System-Single-'></a>
|
||||
### DrawStringFixedWidth(graphics,s,font,brush,x,y,width) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Draws the specified text string at the specified location with the specified [Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') and [Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') objects.
|
||||
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -266,7 +271,7 @@ Draws the specified text string at the specified location with the specified [Br
|
||||
|
||||
##### Summary
|
||||
|
||||
Draws the specified text string at the specified location with the specified [Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') and [Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') objects.
|
||||
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -284,7 +289,7 @@ Draws the specified text string at the specified location with the specified [Br
|
||||
|
||||
##### Summary
|
||||
|
||||
Draws the specified text string at the specified location with the specified [Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') and [Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') objects.
|
||||
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -302,7 +307,7 @@ Draws the specified text string at the specified location with the specified [Br
|
||||
|
||||
##### Summary
|
||||
|
||||
Draws the specified text string at the specified location with the specified [Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') and [Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') objects.
|
||||
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -314,6 +319,60 @@ Draws the specified text string at the specified location with the specified [Br
|
||||
| brush | [System.Drawing.Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') | [Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') that determines the color and texture of the drawn text. |
|
||||
| point | [System.Drawing.PointF](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.PointF 'System.Drawing.PointF') | [PointF](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.PointF 'System.Drawing.PointF') structure that specifies the upper-left corner of the drawn text. |
|
||||
|
||||
<a name='M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringNoLeftPadding-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Single,System-Single-'></a>
|
||||
### DrawStringNoLeftPadding(graphics,s,font,brush,x,y) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| graphics | [System.Drawing.Graphics](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Graphics 'System.Drawing.Graphics') | Graphics object. |
|
||||
| s | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | String to draw. |
|
||||
| font | [System.Drawing.Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') | [Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') that defines the text format of the string. |
|
||||
| brush | [System.Drawing.Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') | [Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') that determines the color and texture of the drawn text. |
|
||||
| x | [System.Single](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Single 'System.Single') | The x-coordinate of the upper-left corner of the drawn text. |
|
||||
| y | [System.Single](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Single 'System.Single') | The y-coordinate of the upper-left corner of the drawn text. |
|
||||
|
||||
<a name='M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-DrawStringNoLeftPadding-System-Drawing-Graphics,System-String,System-Drawing-Font,System-Drawing-Brush,System-Drawing-PointF-'></a>
|
||||
### DrawStringNoLeftPadding(graphics,s,font,brush,point) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| graphics | [System.Drawing.Graphics](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Graphics 'System.Drawing.Graphics') | Graphics object. |
|
||||
| s | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | String to draw. |
|
||||
| font | [System.Drawing.Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') | [Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') that defines the text format of the string. |
|
||||
| brush | [System.Drawing.Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') | [Brush](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Brush 'System.Drawing.Brush') that determines the color and texture of the drawn text. |
|
||||
| point | [System.Drawing.PointF](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.PointF 'System.Drawing.PointF') | [PointF](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.PointF 'System.Drawing.PointF') structure that specifies the upper-left corner of the drawn text. |
|
||||
|
||||
<a name='M-DesktopMagicPluginAPI-Drawing-GraphicsExtentions-MeasureStringNoLeftPadding-System-Drawing-Graphics,System-String,System-Drawing-Font-'></a>
|
||||
### MeasureStringNoLeftPadding(graphics,text,font) `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
|
||||
|
||||
##### Returns
|
||||
|
||||
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| graphics | [System.Drawing.Graphics](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Graphics 'System.Drawing.Graphics') | Graphics object. |
|
||||
| text | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | String to measure. |
|
||||
| font | [System.Drawing.Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') | [Font](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Drawing.Font 'System.Drawing.Font') that defines the text format of the string. |
|
||||
|
||||
<a name='T-DesktopMagicPluginAPI-IPluginData'></a>
|
||||
## IPluginData `type`
|
||||
|
||||
@@ -417,6 +476,13 @@ Gets the corner radius of the current theme.
|
||||
|
||||
Gets the font of the current theme.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-ITheme-Margin'></a>
|
||||
### Margin `property`
|
||||
|
||||
##### Summary
|
||||
|
||||
Gets the corner radius of the current theme.
|
||||
|
||||
<a name='P-DesktopMagicPluginAPI-ITheme-PrimaryColor'></a>
|
||||
### PrimaryColor `property`
|
||||
|
||||
@@ -654,6 +720,17 @@ Occurs once when the plugin gets activated.
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
<a name='M-DesktopMagicPluginAPI-Plugin-Stop'></a>
|
||||
### Stop() `method`
|
||||
|
||||
##### Summary
|
||||
|
||||
Occurs once when the plugin gets deactivated.
|
||||
|
||||
##### Parameters
|
||||
|
||||
This method has no parameters.
|
||||
|
||||
<a name='T-DesktopMagicPluginAPI-Drawing-RenderQuality'></a>
|
||||
## RenderQuality `type`
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<members>
|
||||
<member name="T:DesktopMagicPluginAPI.Drawing.GraphicsExtentions">
|
||||
<summary>
|
||||
Extentions for the <see cref="T:System.Drawing.Graphics"/> class.
|
||||
Extensions for the <see cref="T:System.Drawing.Graphics"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringMonospace(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single)">
|
||||
<summary>
|
||||
Draws the specified text string at the specified location with the specified <see cref="T:System.Drawing.Brush"/> and <see cref="T:System.Drawing.Font"/> objects.
|
||||
<inheritdoc cref="M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single)"/>
|
||||
</summary>
|
||||
<param name="graphics">Graphics object.</param>
|
||||
<param name="s">String to draw.</param>
|
||||
@@ -22,7 +22,7 @@
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringMonospace(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF)">
|
||||
<summary>
|
||||
Draws the specified text string at the specified location with the specified <see cref="T:System.Drawing.Brush"/> and <see cref="T:System.Drawing.Font"/> objects.
|
||||
<inheritdoc cref="M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF)"/>
|
||||
</summary>
|
||||
<param name="graphics">Graphics object.</param>
|
||||
<param name="s">String to draw.</param>
|
||||
@@ -32,7 +32,7 @@
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringFixedWidth(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Draws the specified text string at the specified location with the specified <see cref="T:System.Drawing.Brush"/> and <see cref="T:System.Drawing.Font"/> objects.
|
||||
<inheritdoc cref="M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single)"/>
|
||||
</summary>
|
||||
<param name="graphics">Graphics object.</param>
|
||||
<param name="s">String to draw.</param>
|
||||
@@ -44,7 +44,7 @@
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringFixedWidth(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF,System.Single)">
|
||||
<summary>
|
||||
Draws the specified text string at the specified location with the specified <see cref="T:System.Drawing.Brush"/> and <see cref="T:System.Drawing.Font"/> objects.
|
||||
<inheritdoc cref="M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF)"/>
|
||||
</summary>
|
||||
<param name="graphics">Graphics object.</param>
|
||||
<param name="s">String to draw.</param>
|
||||
@@ -53,6 +53,36 @@
|
||||
<param name="point"><see cref="T:System.Drawing.PointF"/> structure that specifies the upper-left corner of the drawn text.</param>
|
||||
<param name="width">The specified width.</param>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringNoLeftPadding(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single)">
|
||||
<summary>
|
||||
<inheritdoc cref="M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single)"/>
|
||||
</summary>
|
||||
<param name="graphics">Graphics object.</param>
|
||||
<param name="s">String to draw.</param>
|
||||
<param name="font"><see cref="T:System.Drawing.Font"/> that defines the text format of the string.</param>
|
||||
<param name="brush"><see cref="T:System.Drawing.Brush"/> that determines the color and texture of the drawn text.</param>
|
||||
<param name="x">The x-coordinate of the upper-left corner of the drawn text.</param>
|
||||
<param name="y">The y-coordinate of the upper-left corner of the drawn text.</param>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Drawing.GraphicsExtentions.DrawStringNoLeftPadding(System.Drawing.Graphics,System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF)">
|
||||
<summary>
|
||||
<inheritdoc cref="M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF)"/>
|
||||
</summary>
|
||||
<param name="graphics">Graphics object.</param>
|
||||
<param name="s">String to draw.</param>
|
||||
<param name="font"><see cref="T:System.Drawing.Font"/> that defines the text format of the string.</param>
|
||||
<param name="brush"><see cref="T:System.Drawing.Brush"/> that determines the color and texture of the drawn text.</param>
|
||||
<param name="point"><see cref="T:System.Drawing.PointF"/> structure that specifies the upper-left corner of the drawn text.</param>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Drawing.GraphicsExtentions.MeasureStringNoLeftPadding(System.Drawing.Graphics,System.String,System.Drawing.Font)">
|
||||
<summary>
|
||||
<inheritdoc cref="M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font)"/>
|
||||
</summary>
|
||||
<param name="graphics">Graphics object.</param>
|
||||
<param name="text">String to measure.</param>
|
||||
<param name="font"><see cref="T:System.Drawing.Font"/> that defines the text format of the string.</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:DesktopMagicPluginAPI.Drawing.RenderQuality">
|
||||
<summary>
|
||||
Specifies which render quality is used to display the bitmap images.
|
||||
@@ -351,6 +381,11 @@
|
||||
Gets the corner radius of the current theme.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:DesktopMagicPluginAPI.ITheme.Margin">
|
||||
<summary>
|
||||
Gets the corner radius of the current theme.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DesktopMagicPluginAPI.Plugin">
|
||||
<summary>
|
||||
The plugin class.
|
||||
@@ -376,6 +411,11 @@
|
||||
Occurs once when the plugin gets activated.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Plugin.Stop">
|
||||
<summary>
|
||||
Occurs once when the plugin gets deactivated.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:DesktopMagicPluginAPI.Plugin.Main">
|
||||
<summary>
|
||||
Occurs when the <see cref="P:DesktopMagicPluginAPI.Plugin.UpdateInterval"/> elapses.
|
||||
|
||||
@@ -5,14 +5,14 @@ using System.Drawing;
|
||||
namespace DesktopMagicPluginAPI.Drawing
|
||||
{
|
||||
/// <summary>
|
||||
/// Extentions for the <see cref="Graphics"/> class.
|
||||
/// Extensions for the <see cref="Graphics"/> class.
|
||||
/// </summary>
|
||||
public static class GraphicsExtentions
|
||||
{
|
||||
private static readonly Dictionary<Font, int> fonts = new Dictionary<Font, int>(new FontComparer());
|
||||
|
||||
/// <summary>
|
||||
/// Draws the specified text string at the specified location with the specified <see cref="Brush"/> and <see cref="Font"/> objects.
|
||||
/// <inheritdoc cref="Graphics.DrawString(string?, Font, Brush, float, float)"/>
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics object.</param>
|
||||
/// <param name="s">String to draw.</param>
|
||||
@@ -22,7 +22,7 @@ namespace DesktopMagicPluginAPI.Drawing
|
||||
/// <param name="y">The y-coordinate of the upper-left corner of the drawn text.</param>
|
||||
public static void DrawStringMonospace(this Graphics graphics, string s, Font font, Brush brush, float x, float y)
|
||||
{
|
||||
int widest = GetWidestChar(font);
|
||||
int widest = graphics.GetWidestChar(font);
|
||||
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
@@ -33,7 +33,7 @@ namespace DesktopMagicPluginAPI.Drawing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the specified text string at the specified location with the specified <see cref="Brush"/> and <see cref="Font"/> objects.
|
||||
/// <inheritdoc cref="Graphics.DrawString(string?, Font, Brush, PointF)"/>
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics object.</param>
|
||||
/// <param name="s">String to draw.</param>
|
||||
@@ -42,7 +42,7 @@ namespace DesktopMagicPluginAPI.Drawing
|
||||
/// <param name="point"><see cref="PointF"/> structure that specifies the upper-left corner of the drawn text.</param>
|
||||
public static void DrawStringMonospace(this Graphics graphics, string s, Font font, Brush brush, PointF point)
|
||||
{
|
||||
int widest = GetWidestChar(font);
|
||||
int widest = graphics.GetWidestChar(font);
|
||||
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace DesktopMagicPluginAPI.Drawing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the specified text string at the specified location with the specified <see cref="Brush"/> and <see cref="Font"/> objects.
|
||||
/// <inheritdoc cref="Graphics.DrawString(string?, Font, Brush, float, float)"/>
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics object.</param>
|
||||
/// <param name="s">String to draw.</param>
|
||||
@@ -73,7 +73,7 @@ namespace DesktopMagicPluginAPI.Drawing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the specified text string at the specified location with the specified <see cref="Brush"/> and <see cref="Font"/> objects.
|
||||
/// <inheritdoc cref="Graphics.DrawString(string?, Font, Brush, PointF)"/>
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics object.</param>
|
||||
/// <param name="s">String to draw.</param>
|
||||
@@ -91,12 +91,76 @@ namespace DesktopMagicPluginAPI.Drawing
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetWidestChar(Font font)
|
||||
/// <summary>
|
||||
///<inheritdoc cref="Graphics.DrawString(string?, Font, Brush, float, float)"/>
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics object.</param>
|
||||
/// <param name="s">String to draw.</param>
|
||||
/// <param name="font"><see cref="Font"/> that defines the text format of the string.</param>
|
||||
/// <param name="brush"><see cref="Brush"/> that determines the color and texture of the drawn text.</param>
|
||||
/// <param name="x">The x-coordinate of the upper-left corner of the drawn text.</param>
|
||||
/// <param name="y">The y-coordinate of the upper-left corner of the drawn text.</param>
|
||||
public static void DrawStringNoLeftPadding(this Graphics graphics, string s, Font font, Brush brush, float x, float y)
|
||||
{
|
||||
// measure left padding
|
||||
StringFormat sf = new StringFormat(StringFormatFlags.NoClip);
|
||||
sf.SetMeasurableCharacterRanges(new CharacterRange[] { new CharacterRange(0, 1) });
|
||||
Region[] r = graphics.MeasureCharacterRanges(s, font, new RectangleF(0, 0, 1000, 100), sf);
|
||||
float leftPadding = r[0].GetBounds(graphics).Left;
|
||||
|
||||
// draw string
|
||||
sf = new StringFormat(StringFormatFlags.NoClip);
|
||||
graphics.DrawString(s, font, brush, x - leftPadding, y, sf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="Graphics.DrawString(string?, Font, Brush, PointF)"/>
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics object.</param>
|
||||
/// <param name="s">String to draw.</param>
|
||||
/// <param name="font"><see cref="Font"/> that defines the text format of the string.</param>
|
||||
/// <param name="brush"><see cref="Brush"/> that determines the color and texture of the drawn text.</param>
|
||||
/// <param name="point"><see cref="PointF"/> structure that specifies the upper-left corner of the drawn text.</param>
|
||||
public static void DrawStringNoLeftPadding(this Graphics graphics, string s, Font font, Brush brush, PointF point)
|
||||
{
|
||||
// measure left padding
|
||||
StringFormat sf = new StringFormat(StringFormatFlags.NoClip);
|
||||
sf.SetMeasurableCharacterRanges(new CharacterRange[] { new CharacterRange(0, 1) });
|
||||
Region[] r = graphics.MeasureCharacterRanges(s, font, new RectangleF(0, 0, 1000, 100), sf);
|
||||
float leftPadding = r[0].GetBounds(graphics).Left;
|
||||
|
||||
// draw string
|
||||
sf = new StringFormat(StringFormatFlags.NoClip);
|
||||
graphics.DrawString(s, font, brush, point.X - leftPadding, point.Y, sf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="Graphics.MeasureString(string, Font)"/>
|
||||
/// </summary>
|
||||
/// <param name="graphics">Graphics object.</param>
|
||||
/// <param name="text">String to measure.</param>
|
||||
/// <param name="font"><see cref="Font"/> that defines the text format of the string.</param>
|
||||
/// <returns></returns>
|
||||
public static SizeF MeasureStringNoLeftPadding(this Graphics graphics, string text, Font font)
|
||||
{
|
||||
SizeF size = graphics.MeasureString(text, font, int.MaxValue);
|
||||
|
||||
StringFormat sf = new StringFormat(StringFormatFlags.NoClip);
|
||||
sf.SetMeasurableCharacterRanges(new CharacterRange[] { new CharacterRange(0, 1) });
|
||||
Region[] r = graphics.MeasureCharacterRanges(text, font, new RectangleF(0, 0, 1000, 100), sf);
|
||||
float leftPadding = r[0].GetBounds(graphics).Left;
|
||||
|
||||
size.Width -= leftPadding / 1.5f;
|
||||
return size;
|
||||
}
|
||||
|
||||
private static int GetWidestChar(this Graphics graphics, Font font)
|
||||
{
|
||||
if (fonts.ContainsKey(font))
|
||||
{
|
||||
return fonts[font];
|
||||
}
|
||||
|
||||
Graphics graphics = Graphics.FromImage(new Bitmap(1, 1));
|
||||
float max = 0;
|
||||
char maxx = ' ';
|
||||
for (int i = 0; i <= 255; i++)
|
||||
|
||||
@@ -31,5 +31,10 @@ namespace DesktopMagicPluginAPI
|
||||
/// Gets the corner radius of the current theme.
|
||||
/// </summary>
|
||||
int CornerRadius { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the corner radius of the current theme.
|
||||
/// </summary>
|
||||
int Margin { get; }
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,13 @@ namespace DesktopMagicPluginAPI
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs once when the plugin gets deactivated.
|
||||
/// </summary>
|
||||
public virtual void Stop()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the <see cref="UpdateInterval"/> elapses.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user