👾 修复 动画 End 异常、修复 PageHeader 最小化按钮某字体不显示、修复 组合 Emoji 字素簇拆分异常

This commit is contained in:
Tom
2025-12-01 16:44:28 +08:00
parent 8e2d71e252
commit 96eee9d3a3
18 changed files with 3488 additions and 3433 deletions

View File

@@ -788,7 +788,7 @@ namespace AntdUI.Chat
}
break;
default:
if (nType == 18)
if (nType == 18 || (nType == 4 && SvgDb.Emoji.ContainsKey(it)))
{
item.HasEmoji = true;
font_widths.Add(new CacheFont(it, true, 0, type));
@@ -815,17 +815,10 @@ namespace AntdUI.Chat
if (item.HasEmoji)
{
using (var font = new Font(EmojiFont, Font.Size))
if (font_height == 0) font_height = FixFontWidth(g).Height;
foreach (var it in font_widths)
{
foreach (var it in font_widths)
{
if (it.emoji)
{
var sizefont = g.MeasureString(it.text, font);
if (font_height < sizefont.Height) font_height = sizefont.Height;
it.width = sizefont.Width;
}
}
if (it.emoji) it.width = font_height;
}
}

View File

@@ -1184,13 +1184,13 @@ namespace AntdUI
{
ExpandProg = val;
PARENT.LoadLayout();
}, 10, t, oldval, () =>
}, 10, t, oldval, value).SetEnd(() =>
{
if (PARENT.AutoSize) PARENT.canset = true;
ExpandProg = 1F;
ExpandThread = false;
PARENT.LoadLayout();
}, value));
}));
}
else
{

View File

@@ -653,12 +653,12 @@ namespace AntdUI
{
ExpandProg = val;
Invalidates();
}, 10, Animation.TotalFrames(10, 200), oldval, () =>
}, 10, Animation.TotalFrames(10, 200), oldval, value).SetEnd(() =>
{
ExpandProg = 1F;
ExpandThread = false;
Invalidates();
}, value));
}));
}
else
{

View File

@@ -70,6 +70,8 @@ namespace AntdUI
[Obsolete("use FormatFlags")]
Size MeasureText(string? text, Font font, int width, StringFormat format);
Size MeasureText(string? text, Font font, int width, FormatFlags format = FormatFlags.Center);
Region[] MeasureCharacterRanges(string? text, Font font, Rectangle rect, FormatFlags format = FormatFlags.Center);
Region[] MeasureCharacterRanges(string? text, Font font, Rectangle rect, StringFormat format);
#endregion
@@ -106,6 +108,8 @@ namespace AntdUI
bool Image(Image bmp, Rectangle rect, float opacity);
bool Image(Image bmp, Rectangle destRect, Rectangle srcRect, float opacity);
bool Image(Image bmp, Rectangle destRect, Rectangle srcRect, float opacity, GraphicsUnit srcUnit);
bool Image(Image bmp, RectangleF destRect, RectangleF srcRect, float opacity);
bool Image(Image bmp, RectangleF destRect, RectangleF srcRect, float opacity, GraphicsUnit srcUnit);
#endregion
@@ -218,14 +222,22 @@ namespace AntdUI
void SetClip(Rectangle rect, CombineMode combineMode);
void SetClip(RectangleF rect, CombineMode combineMode);
void SetClip(GraphicsPath path, CombineMode combineMode);
void SetClip(Region region, CombineMode combineMode);
void ResetClip();
void ResetTransform();
void TranslateTransform(float dx, float dy);
void TranslateTransform(float dx, float dy, MatrixOrder order);
void RotateTransform(float angle);
void RotateTransform(float angle, MatrixOrder order);
void ScaleTransform(float sx, float sy);
void ScaleTransform(float sx, float sy, MatrixOrder order);
float DpiX { get; }
float DpiY { get; }
Matrix Transform { get; set; }
Region Clip { get; set; }
RectangleF RegionBounds(Region region);
CompositingMode CompositingMode { get; set; }
SmoothingMode SmoothingMode { get; set; }
#endregion
}

View File

@@ -38,6 +38,8 @@ namespace AntdUI.Core
public Size MeasureString(string? text, Font font, int width) => MeasureString(text, font, width, FormatFlags.Center);
public Size MeasureString(string? text, Font font, int width, StringFormat format) => g.MeasureString(text, font, width, format).Size();
public Size MeasureString(string? text, Font font, int width, FormatFlags format = FormatFlags.Center) => g.MeasureString(text, font, width, Helper.TF(format, true)).Size();
public Region[] MeasureCharacterRanges(string? text, Font font, Rectangle rect, FormatFlags format = FormatFlags.Center) => g.MeasureCharacterRanges(text, font, rect, Helper.TF(format, true));
public Region[] MeasureCharacterRanges(string? text, Font font, Rectangle rect, StringFormat format) => g.MeasureCharacterRanges(text, font, rect, format);
#endregion
@@ -891,6 +893,36 @@ namespace AntdUI.Core
catch { }
return false;
}
public bool Image(Image bmp, RectangleF destRect, RectangleF srcRect, float opacity) => Image(bmp, destRect, srcRect, opacity, GraphicsUnit.Pixel);
public bool Image(Image bmp, RectangleF destRect, RectangleF srcRect, float opacity, GraphicsUnit srcUnit)
{
try
{
lock (bmp)
{
if (opacity >= 1F)
{
Image(bmp, destRect, srcRect, srcUnit);
return true;
}
using (var attributes = new ImageAttributes())
{
var matrix = new ColorMatrix { Matrix33 = opacity };
attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
var points = new[]
{
destRect.Location,
new PointF(destRect.X + destRect.Width, destRect.Y),
new PointF(destRect.X, destRect.Y + destRect.Height)
};
g.DrawImage(bmp, points, srcRect, srcUnit, attributes);
}
return true;
}
}
catch { }
return false;
}
#endregion
@@ -1384,10 +1416,16 @@ namespace AntdUI.Core
public void SetClip(Rectangle rect, CombineMode combineMode) => g.SetClip(rect, combineMode);
public void SetClip(RectangleF rect, CombineMode combineMode) => g.SetClip(rect, combineMode);
public void SetClip(GraphicsPath path, CombineMode combineMode) => g.SetClip(path, combineMode);
public void SetClip(Region region, CombineMode combineMode) => g.SetClip(region, combineMode);
public void ResetClip() => g.ResetClip();
public void ResetTransform() => g.ResetTransform();
public void TranslateTransform(float dx, float dy) => g.TranslateTransform(dx, dy);
public void TranslateTransform(float dx, float dy, MatrixOrder order) => g.TranslateTransform(dx, dy, order);
public void RotateTransform(float angle) => g.RotateTransform(angle);
public void RotateTransform(float angle, MatrixOrder order) => g.RotateTransform(angle, order);
public void ScaleTransform(float sx, float sy) => g.ScaleTransform(sx, sy);
public void ScaleTransform(float sx, float sy, MatrixOrder order) => g.ScaleTransform(sx, sy, order);
public float DpiX => g.DpiX;
public float DpiY => g.DpiY;
public Matrix Transform
@@ -1400,6 +1438,17 @@ namespace AntdUI.Core
get => g.CompositingMode;
set => g.CompositingMode = value;
}
public SmoothingMode SmoothingMode
{
get => g.SmoothingMode;
set => g.SmoothingMode = value;
}
public Region Clip
{
get => g.Clip;
set => g.Clip = value;
}
public RectangleF RegionBounds(Region region) => region.GetBounds(g);
public void Dispose() => g.Dispose();
#endregion

File diff suppressed because it is too large Load Diff

View File

@@ -2194,13 +2194,13 @@ namespace AntdUI
ExpandProg = val;
ArrowProg = arrow;
Invalidates();
}, 10, t, oldval, () =>
}, 10, t, oldval, value).SetEnd(() =>
{
ExpandProg = 1F;
ArrowProg = value ? 1F : -1F;
ExpandThread = false;
Invalidates();
}, value));
}));
}
else
{

View File

@@ -313,6 +313,8 @@ namespace AntdUI
{
if (icon == value) return;
icon = value;
temp_logo?.Dispose();
temp_logo = null;
Invalidate();
OnPropertyChanged(nameof(Icon));
}
@@ -330,6 +332,8 @@ namespace AntdUI
{
if (iconSvg == value) return;
iconSvg = value;
temp_logo?.Dispose();
temp_logo = null;
Invalidate();
OnPropertyChanged(nameof(IconSvg));
}
@@ -943,102 +947,22 @@ namespace AntdUI
#region
Bitmap? temp_logo, temp_back, temp_back_hover, temp_back_down, temp_full, temp_full_restore, temp_min, temp_max, temp_restore, temp_close, temp_close_hover;
void PrintBack(Canvas g, Color color, Rectangle rect_icon)
{
if (temp_back == null || temp_back.Width != rect_icon.Width)
{
temp_back?.Dispose();
temp_back = SvgExtend.GetImgExtend(BackIcon ?? SvgDb.IcoPageHeaderBack, rect_icon, color);
}
if (temp_back != null) g.Image(temp_back, rect_icon);
}
Bitmap? temp_logo;
void PrintBack(Canvas g, Color color, Rectangle rect_icon) => g.GetImgCanvas(BackIcon ?? SvgDb.IcoPageHeaderBack, rect_icon, color);
void PrintBackHover(Canvas g, Color color, Rectangle rect_icon)
{
PrintBack(g, color, rect_icon);
g.GetImgExtend(BackIcon ?? SvgDb.IcoPageHeaderBack, rect_icon, Helper.ToColor(hove_back.Value, Colour.Primary.Get(nameof(PageHeader), ColorScheme)));
}
void PrintBackHover(Canvas g, Rectangle rect_icon)
{
if (temp_back_hover == null || temp_back_hover.Width != rect_icon.Width)
{
temp_back_hover?.Dispose();
temp_back_hover = SvgExtend.GetImgExtend(BackIcon ?? SvgDb.IcoPageHeaderBack, rect_icon, Colour.Primary.Get(nameof(PageHeader), ColorScheme));
}
if (temp_back_hover != null) g.Image(temp_back_hover, rect_icon);
}
void PrintBackDown(Canvas g, Rectangle rect_icon)
{
if (temp_back_down == null || temp_back_down.Width != rect_icon.Width)
{
temp_back_down?.Dispose();
temp_back_down = SvgExtend.GetImgExtend(BackIcon ?? SvgDb.IcoPageHeaderBack, rect_icon, Colour.PrimaryActive.Get(nameof(PageHeader), ColorScheme));
}
if (temp_back_down != null) g.Image(temp_back_down, rect_icon);
}
void PrintClose(Canvas g, Color color, Rectangle rect_icon)
{
if (temp_close == null || temp_close.Width != rect_icon.Width)
{
temp_close?.Dispose();
temp_close = SvgExtend.GetImgExtend(SvgDb.IcoAppClose, rect_icon, color);
}
if (temp_close != null) g.Image(temp_close, rect_icon);
}
void PrintCloseHover(Canvas g, Rectangle rect_icon)
{
if (temp_close_hover == null || temp_close_hover.Width != rect_icon.Width)
{
temp_close_hover?.Dispose();
temp_close_hover = SvgExtend.GetImgExtend(SvgDb.IcoAppClose, rect_icon, Colour.ErrorColor.Get(nameof(PageHeader), ColorScheme));
}
if (temp_close_hover != null) g.Image(temp_close_hover, rect_icon);
}
void PrintFull(Canvas g, Color color, Rectangle rect_icon)
{
if (temp_full == null || temp_full.Width != rect_icon.Width)
{
temp_full?.Dispose();
temp_full = SvgExtend.GetImgExtend(SvgDb.IcoAppFull, rect_icon, color);
}
if (temp_full != null) g.Image(temp_full, rect_icon);
}
void PrintFullRestore(Canvas g, Color color, Rectangle rect_icon)
{
if (temp_full_restore == null || temp_full_restore.Width != rect_icon.Width)
{
temp_full_restore?.Dispose();
temp_full_restore = SvgExtend.GetImgExtend(SvgDb.IcoAppFullRestore, rect_icon, color);
}
if (temp_full_restore != null) g.Image(temp_full_restore, rect_icon);
}
void PrintMax(Canvas g, Color color, Rectangle rect_icon)
{
if (temp_max == null || temp_max.Width != rect_icon.Width)
{
temp_max?.Dispose();
temp_max = SvgExtend.GetImgExtend(SvgDb.IcoAppMax, rect_icon, color);
}
if (temp_max != null) g.Image(temp_max, rect_icon);
}
void PrintRestore(Canvas g, Color color, Rectangle rect_icon)
{
if (temp_restore == null || temp_restore.Width != rect_icon.Width)
{
temp_restore?.Dispose();
temp_restore = SvgExtend.GetImgExtend(SvgDb.IcoAppRestore, rect_icon, color);
}
if (temp_restore != null) g.Image(temp_restore, rect_icon);
}
void PrintMin(Canvas g, Color color, Rectangle rect_icon)
{
if (temp_min == null || temp_min.Width != rect_icon.Width)
{
temp_min?.Dispose();
temp_min = SvgExtend.GetImgExtend(SvgDb.IcoAppMin, rect_icon, color);
}
if (temp_min != null) g.Image(temp_min, rect_icon);
PrintBack(g, Helper.ToColor(hove_back.Value, Colour.Primary.Get(nameof(PageHeader), ColorScheme)), rect_icon);
}
void PrintBackHover(Canvas g, Rectangle rect_icon) => PrintBack(g, Colour.Primary.Get(nameof(PageHeader), ColorScheme), rect_icon);
void PrintBackDown(Canvas g, Rectangle rect_icon) => PrintBack(g, Colour.PrimaryActive.Get(nameof(PageHeader), ColorScheme), rect_icon);
void PrintClose(Canvas g, Color color, Rectangle rect_icon) => g.GetImgCanvas(SvgDb.IcoAppClose, rect_icon, color);
void PrintCloseHover(Canvas g, Rectangle rect_icon) => g.GetImgCanvas(SvgDb.IcoAppClose, rect_icon, Colour.ErrorColor.Get(nameof(PageHeader), ColorScheme));
void PrintFull(Canvas g, Color color, Rectangle rect_icon) => g.GetImgCanvas(SvgDb.IcoAppFull, rect_icon, color);
void PrintFullRestore(Canvas g, Color color, Rectangle rect_icon) => g.GetImgCanvas(SvgDb.IcoAppFullRestore, rect_icon, color);
void PrintMax(Canvas g, Color color, Rectangle rect_icon) => g.GetImgCanvas(SvgDb.IcoAppMax, rect_icon, color);
void PrintRestore(Canvas g, Color color, Rectangle rect_icon) => g.GetImgCanvas(SvgDb.IcoAppRestore, rect_icon, color);
void PrintMin(Canvas g, Color color, Rectangle rect_icon) => g.GetImgCanvas(SvgDb.IcoAppMin, rect_icon, color);
bool PrintLogo(Canvas g, string svg, Color color, Rectangle rect_icon)
{
if (temp_logo == null || temp_logo.Width != rect_icon.Width)
@@ -1053,25 +977,7 @@ namespace AntdUI
void DisposeBmp()
{
temp_logo?.Dispose();
temp_back?.Dispose();
temp_back_hover?.Dispose();
temp_back_down?.Dispose();
temp_full?.Dispose();
temp_full_restore?.Dispose();
temp_min?.Dispose();
temp_max?.Dispose();
temp_restore?.Dispose();
temp_close?.Dispose();
temp_close_hover?.Dispose();
temp_logo = null;
temp_back = temp_back_hover = temp_back_down = null;
temp_full = null;
temp_full_restore = null;
temp_min = null;
temp_max = null;
temp_restore = null;
temp_close = null;
temp_close_hover = null;
}
#endregion

View File

@@ -1782,12 +1782,12 @@ namespace AntdUI
{
ExpandProg = val;
Invalidates();
}, 10, t, oldval, () =>
}, 10, t, oldval, value).SetEnd(() =>
{
ExpandProg = 1F;
ExpandThread = false;
Invalidates();
}, value));
}));
}
else
{

View File

@@ -838,7 +838,7 @@ namespace AntdUI
/// </summary>
public class AnimationFixed2Config : IAnimationConfig
{
public AnimationFixed2Config(Action<int, float> call, int interval, int totalFrames, float value, Action end, bool sw, AnimationType type = AnimationType.Ball)
public AnimationFixed2Config(Action<int, float> call, int interval, int totalFrames, float value, bool sw, AnimationType type = AnimationType.Ball)
{
Call = call;
Interval = interval;
@@ -847,7 +847,7 @@ namespace AntdUI
LR = sw;
Type = type;
}
public AnimationFixed2Config(Action<int, float, float> call, int interval, int totalFrames, float value, Action end, bool sw, AnimationType type = AnimationType.Ball)
public AnimationFixed2Config(Action<int, float, float> call, int interval, int totalFrames, float value, bool sw, AnimationType type = AnimationType.Ball)
{
Call = call;
Interval = interval;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,12 +3,10 @@
// COPYRIGHT (C) svg-net. ALL RIGHTS RESERVED.
// GITHUB: https://github.com/svg-net/SVG
using System.Drawing;
namespace AntdUI.Svg
{
public interface IGraphicsProvider
{
Graphics GetGraphics();
Canvas GetGraphics();
}
}

View File

@@ -13,7 +13,6 @@ namespace AntdUI.Svg
{
float DpiY { get; }
void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit);
void DrawImageUnscaled(Image image, Point location);
void DrawPath(Pen pen, GraphicsPath path);
void FillPath(Brush brush, GraphicsPath path);
ISvgBoundable GetBoundable();

View File

@@ -6,7 +6,6 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
namespace AntdUI.Svg
@@ -16,7 +15,7 @@ namespace AntdUI.Svg
/// </summary>
public sealed class SvgRenderer : ISvgRenderer, IGraphicsProvider
{
private readonly Graphics _innerGraphics;
private readonly Canvas _innerGraphics;
private readonly bool _disposable;
private readonly Image _image;
@@ -43,12 +42,12 @@ namespace AntdUI.Svg
/// <summary>
/// Initializes a new instance of the <see cref="ISvgRenderer"/> class.
/// </summary>
private SvgRenderer(Graphics graphics, bool disposable = true)
private SvgRenderer(Canvas graphics, bool disposable = true)
{
_innerGraphics = graphics;
_disposable = disposable;
}
private SvgRenderer(Graphics graphics, Image image)
private SvgRenderer(Canvas graphics, Image image)
: this(graphics)
{
_image = image;
@@ -56,34 +55,15 @@ namespace AntdUI.Svg
public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit)
{
_innerGraphics.DrawImage(image, destRect, srcRect, graphicsUnit);
_innerGraphics.Image(image, destRect, srcRect, graphicsUnit);
}
public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit graphicsUnit, float opacity)
{
var matrix = new ColorMatrix { Matrix33 = opacity };
var attributes = new ImageAttributes();
attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
var points = new[]
{
destRect.Location,
new PointF(destRect.X + destRect.Width, destRect.Y),
new PointF(destRect.X, destRect.Y + destRect.Height)
};
_innerGraphics.DrawImage(image, points, srcRect, graphicsUnit, attributes);
_innerGraphics.Image(image, destRect, srcRect, opacity, graphicsUnit);
}
public void DrawImageUnscaled(Image image, Point location)
{
_innerGraphics.DrawImageUnscaled(image, location);
}
public void DrawPath(Pen pen, GraphicsPath path)
{
_innerGraphics.DrawPath(pen, path);
}
public void FillPath(Brush brush, GraphicsPath path)
{
_innerGraphics.FillPath(brush, path);
}
public void DrawPath(Pen pen, GraphicsPath path) => _innerGraphics.Draw(pen, path);
public void FillPath(Brush brush, GraphicsPath path) => _innerGraphics.Fill(brush, path);
public Region GetClip()
{
return _innerGraphics.Clip;
@@ -125,19 +105,16 @@ namespace AntdUI.Svg
_image.Dispose();
}
Graphics IGraphicsProvider.GetGraphics()
{
return _innerGraphics;
}
Canvas IGraphicsProvider.GetGraphics() => _innerGraphics;
private static Graphics CreateGraphics(Image image)
private static Canvas CreateGraphics(Image image)
{
var g = Graphics.FromImage(image);
g.PixelOffsetMode = PixelOffsetMode.Half;
g.CompositingQuality = CompositingQuality.HighQuality;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.TextContrast = 1;
return g;
return new Core.CanvasGDI(g);
}
/// <summary>
@@ -154,7 +131,7 @@ namespace AntdUI.Svg
/// Creates a new <see cref="ISvgRenderer"/> from the specified <see cref="Graphics"/>.
/// </summary>
/// <param name="graphics">The <see cref="Graphics"/> to create the renderer from.</param>
public static ISvgRenderer FromGraphics(Graphics graphics)
public static ISvgRenderer FromGraphics(Canvas graphics)
{
return new SvgRenderer(graphics, false);
}

View File

@@ -227,7 +227,7 @@ namespace AntdUI.Svg
/// </summary>
/// <param name="graphics">The <see cref="Graphics"/> to be rendered to.</param>
/// <exception cref="ArgumentNullException">The <paramref name="graphics"/> parameter cannot be <c>null</c>.</exception>
public void Draw(Graphics graphics)
public void Draw(Canvas graphics)
{
Draw(graphics, null);
}
@@ -238,7 +238,7 @@ namespace AntdUI.Svg
/// <param name="graphics">The <see cref="Graphics"/> to be rendered to.</param>
/// <param name="size">The <see cref="SizeF"/> to render the document. If <c>null</c> document is rendered at the default document size.</param>
/// <exception cref="ArgumentNullException">The <paramref name="graphics"/> parameter cannot be <c>null</c>.</exception>
public void Draw(Graphics graphics, SizeF? size)
public void Draw(Canvas graphics, SizeF? size)
{
using (var renderer = SvgRenderer.FromGraphics(graphics))
{

View File

@@ -55,7 +55,7 @@ namespace AntdUI.Svg
format.SetMeasurableCharacterRanges((from r in Enumerable.Range(32 * s, Math.Min(32, text.Length - 32 * s))
select new CharacterRange(r, 1)).ToArray());
regions.AddRange(from r in g.MeasureCharacterRanges(text, _font, new Rectangle(0, 0, 1000, 1000), format)
select r.GetBounds(g));
select g.RegionBounds(r));
}
return regions;
}
@@ -63,18 +63,19 @@ namespace AntdUI.Svg
public SizeF MeasureString(ISvgRenderer renderer, string text)
{
var g = GetGraphics(renderer);
//return new SizeF(g.MeasureString(text, _font, 1000).Width, Ascent(renderer));
StringFormat format = StringFormat.GenericTypographic.Clone() as StringFormat;
format.SetMeasurableCharacterRanges(new CharacterRange[] { new CharacterRange(0, text.Length) });
format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
Region[] r = g.MeasureCharacterRanges(text, _font, new Rectangle(0, 0, 1000, 1000), format);
RectangleF rect = r[0].GetBounds(g);
RectangleF rect = g.RegionBounds(r[0]);
return new SizeF(rect.Width, Ascent(renderer));
}
Graphics? _graphics;
Canvas? _graphics;
Bitmap? _bitmap;
private Graphics GetGraphics(object renderer)
private Canvas GetGraphics(object renderer)
{
var provider = renderer as IGraphicsProvider;
if (provider == null)
@@ -82,7 +83,7 @@ namespace AntdUI.Svg
if (_graphics == null)
{
_bitmap = new Bitmap(1, 1);
_graphics = Graphics.FromImage(_bitmap);
_graphics = new Core.CanvasGDI(Graphics.FromImage(_bitmap));
}
return _graphics;
}

View File

@@ -41,6 +41,22 @@ namespace AntdUI
}
return false;
}
public static bool GetImgCanvas(this Canvas g, string svg, Rectangle rect, Color? color = null)
{
if (rect.Width > 0 && rect.Height > 0)
{
var doc = SvgDocument(svg);
if (doc == null) return false;
if (color.HasValue) doc.Fill = new Svg.SvgColourServer(color.Value);
doc.Width = rect.Width;
doc.Height = rect.Height;
var state = g.Save();
g.TranslateTransform(rect.X, rect.Y);
doc.Draw(g, rect.Size);
g.Restore(state);
}
return false;
}
/// <summary>
/// SVG转图片