重构GDI一些方法
This commit is contained in:
parent
54940a41db
commit
922c52914c
@ -243,7 +243,7 @@ namespace Sunny.UI
|
|||||||
Gr.DrawLine(pen, ptStart, ptEnd);
|
Gr.DrawLine(pen, ptStart, ptEnd);
|
||||||
|
|
||||||
//Draw Strings
|
//Draw Strings
|
||||||
Font font = new Font(this.AnalogMeter.Font.FontFamily, (float)(6F * drawRatio));
|
using Font font = new Font(this.AnalogMeter.Font.FontFamily, (float)(6F * drawRatio));
|
||||||
|
|
||||||
float tx = (float)(cx + (radius - (20 * drawRatio)) * Math.Cos(currentAngle));
|
float tx = (float)(cx + (radius - (20 * drawRatio)) * Math.Cos(currentAngle));
|
||||||
float ty = (float)(cy + (radius - (20 * drawRatio)) * Math.Sin(currentAngle));
|
float ty = (float)(cy + (radius - (20 * drawRatio)) * Math.Sin(currentAngle));
|
||||||
|
@ -560,6 +560,7 @@ namespace Sunny.UI
|
|||||||
brushKnobPointer.Dispose();
|
brushKnobPointer.Dispose();
|
||||||
gOffScreen?.Dispose();
|
gOffScreen?.Dispose();
|
||||||
OffScreenImage?.Dispose();
|
OffScreenImage?.Dispose();
|
||||||
|
_scaleFont?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UIKnob()
|
public UIKnob()
|
||||||
@ -1057,8 +1058,6 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void SetDimensions()
|
private void SetDimensions()
|
||||||
{
|
{
|
||||||
Font font;
|
|
||||||
|
|
||||||
// Rectangle
|
// Rectangle
|
||||||
float x, y, w, h;
|
float x, y, w, h;
|
||||||
x = 0;
|
x = 0;
|
||||||
@ -1082,7 +1081,7 @@ namespace Sunny.UI
|
|||||||
String str = String.Format("{0,0:D}", (int)val);
|
String str = String.Format("{0,0:D}", (int)val);
|
||||||
|
|
||||||
float fSize = _scaleFont.Size;
|
float fSize = _scaleFont.Size;
|
||||||
|
Font font;
|
||||||
if (_scaleFontAutoSize)
|
if (_scaleFontAutoSize)
|
||||||
{
|
{
|
||||||
fSize = (float)(6F * drawRatio);
|
fSize = (float)(6F * drawRatio);
|
||||||
@ -1097,6 +1096,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
SizeF strsize = TextRenderer.MeasureText(str, font);
|
SizeF strsize = TextRenderer.MeasureText(str, font);
|
||||||
|
font.Dispose();
|
||||||
|
|
||||||
// Graduations outside
|
// Graduations outside
|
||||||
gradLength = 4 * drawRatio;
|
gradLength = 4 * drawRatio;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user