diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe
index 6d669395..02eb7799 100644
Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ
diff --git a/SunnyUI.sln b/SunnyUI.sln
index bfaa52ea..e426139d 100644
--- a/SunnyUI.sln
+++ b/SunnyUI.sln
@@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SunnyUI", "SunnyUI\SunnyUI.csproj", "{AB1CB247-E20B-4CBE-B269-570ADDD96C53}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SunnyUI.Demo", "SunnyUI.Demo\SunnyUI.Demo.csproj", "{6AE19B87-C2AA-4C56-BC26-1C343F30FF58}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AB1CB247-E20B-4CBE-B269-570ADDD96C53} = {AB1CB247-E20B-4CBE-B269-570ADDD96C53}
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/SunnyUI/Common/UGraphics.cs b/SunnyUI/Common/UGraphics.cs
index a11f7a67..e4f518c1 100644
--- a/SunnyUI/Common/UGraphics.cs
+++ b/SunnyUI/Common/UGraphics.cs
@@ -27,8 +27,20 @@ using System.Windows.Forms;
namespace Sunny.UI
{
+ ///
+ /// GDI扩展类
+ ///
public static class GraphicsEx
{
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 区域
+ /// 格式
public static void DrawString(this Graphics g, string text, Font font, Color color, RectangleF rect, StringFormat format)
{
using (Brush br = color.Brush())
@@ -37,6 +49,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 区域
public static void DrawString(this Graphics g, string text, Font font, Color color, RectangleF rect)
{
using (Brush br = color.Brush())
@@ -45,6 +65,15 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 区域
+ /// 格式
public static void DrawString(this Graphics g, string text, Font font, Color color, Rectangle rect, StringFormat format)
{
using (Brush br = color.Brush())
@@ -53,6 +82,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 区域
public static void DrawString(this Graphics g, string text, Font font, Color color, Rectangle rect)
{
using (Brush br = color.Brush())
@@ -61,6 +98,15 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
public static void DrawString(this Graphics g, string text, Font font, Color color, float x, float y)
{
using (Brush br = color.Brush())
@@ -69,13 +115,38 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 位置
public static void DrawString(this Graphics g, string text, Font font, Color color, Point pt)
=> g.DrawString(text, font, color, pt.X, pt.Y);
+ ///
+ ///
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 位置
public static void DrawString(this Graphics g, string text, Font font, Color color, PointF pt)
=> g.DrawString(text, font, color, pt.X, pt.Y);
-
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 格式
public static void DrawString(this Graphics g, string text, Font font, Color color, float x, float y, StringFormat format)
{
using (Brush br = color.Brush())
@@ -84,13 +155,38 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 位置
+ /// 格式
public static void DrawString(this Graphics g, string text, Font font, Color color, PointF pt, StringFormat format)
=> g.DrawString(text, font, color, pt.X, pt.Y, format);
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 位置
+ /// 格式
public static void DrawString(this Graphics g, string text, Font font, Color color, Point pt, StringFormat format)
=> g.DrawString(text, font, color, pt.X, pt.Y, format);
-
+ ///
+ /// 绘制多条直线连接
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawLines(this Graphics g, Color color, Point[] points, bool smooth = false, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -101,6 +197,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制多条直线连接
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawLines(this Graphics g, Color color, PointF[] points, bool smooth = false, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -111,6 +215,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawCurve(this Graphics g, Color color, Point[] points, bool smooth = false, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -121,6 +233,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawCurve(this Graphics g, Color color, PointF[] points, bool smooth = false, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -131,6 +251,17 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制直线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1水平位置
+ /// 点1垂直位置
+ /// 点2水平位置
+ /// 点2垂直位置
+ /// 平滑
+ /// 笔宽
public static void DrawLine(this Graphics g, Color color, int x1, int y1, int x2, int y2, bool smooth = false, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -141,9 +272,29 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制直线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1
+ /// 点2
+ /// 平滑
+ /// 笔宽
public static void DrawLine(this Graphics g, Color color, Point pt1, Point pt2, bool smooth = false, float penWidth = 1)
=> g.DrawLine(color, pt1.X, pt1.Y, pt2.X, pt2.Y, smooth, penWidth);
+ ///
+ /// 绘制直线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1水平位置
+ /// 点1垂直位置
+ /// 点2水平位置
+ /// 点2垂直位置
+ /// 平滑
+ /// 笔宽
public static void DrawLine(this Graphics g, Color color, float x1, float y1, float x2, float y2, bool smooth = false, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -154,9 +305,31 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制直线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1
+ /// 点2
+ /// 平滑
+ /// 笔宽
public static void DrawLine(this Graphics g, Color color, PointF pt1, PointF pt2, bool smooth = false, float penWidth = 1)
=> g.DrawLine(color, pt1.X, pt1.Y, pt2.X, pt2.Y, smooth, penWidth);
+ ///
+ ///
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 宽度
+ /// 高度
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawArc(this Graphics g, Color color, int x, int y, int width, int height, int startAngle, int sweepAngle, bool smooth = true, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -167,6 +340,19 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制弧线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 宽度
+ /// 高度
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawArc(this Graphics g, Color color, float x, float y, float width, float height, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -177,14 +363,47 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制弧线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawArc(this Graphics g, Color color, Rectangle rect, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
=> g.DrawArc(color, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle, smooth, penWidth);
-
+ ///
+ /// 绘制弧线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawArc(this Graphics g, Color color, RectangleF rect, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
=> g.DrawArc(color, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle, smooth, penWidth);
-
+ ///
+ /// 绘制贝塞尔曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1水平位置
+ /// 点1垂直位置
+ /// 点2水平位置
+ /// 点2垂直位置
+ /// 点3水平位置
+ /// 点3垂直位置
+ /// 点4水平位置
+ /// 点4垂直位置
+ /// 平滑
+ /// 笔宽
public static void DrawBezier(this Graphics g, Color color, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, bool smooth = true, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -195,12 +414,42 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制贝塞尔曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1
+ /// 点2
+ /// 点3
+ /// 点4
+ /// 平滑
+ /// 笔宽
public static void DrawBezier(this Graphics g, Color color, PointF pt1, PointF pt2, PointF pt3, PointF pt4, bool smooth = true, float penWidth = 1)
=> g.DrawBezier(color, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y, smooth, penWidth);
+ ///
+ /// 绘制贝塞尔曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1
+ /// 点2
+ /// 点3
+ /// 点4
+ /// 平滑
+ /// 笔宽
public static void DrawBezier(this Graphics g, Color color, Point pt1, Point pt2, Point pt3, Point pt4, bool smooth = true, float penWidth = 1)
=> g.DrawBezier(color, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y, smooth, penWidth);
+ ///
+ /// 绘制贝塞尔曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawBeziers(this Graphics g, Color color, PointF[] points, bool smooth = true, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -211,6 +460,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制贝塞尔曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawBeziers(this Graphics g, Color color, Point[] points, bool smooth = true, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -221,6 +478,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制闭合曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawClosedCurve(this Graphics g, Color color, Point[] points, bool smooth = true, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -231,6 +496,16 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制闭合曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 张力
+ /// 填充模式
+ /// 平滑
+ /// 笔宽
public static void DrawClosedCurve(this Graphics g, Color color, Point[] points, float tension, FillMode fillmode, bool smooth = true, float penWidth = 1)
{
using (Pen pen = color.Pen(penWidth))
@@ -241,6 +516,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充闭合曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
public static void FillClosedCurve(this Graphics g, Color color, Point[] points, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -251,6 +533,15 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充闭合曲线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 填充模式
+ /// 张力
+ /// 平滑
public static void FillClosedCurve(this Graphics g, Color color, Point[] points, FillMode fillmode, float tension, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -261,6 +552,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充路径
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 路径
+ /// 平滑
public static void FillPath(this Graphics g, Color color, GraphicsPath path, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -271,6 +569,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制路径
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 路径
+ /// 平滑
+ /// 笔宽
public static void DrawPath(this Graphics g, Color color, GraphicsPath path, bool smooth = true, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -281,6 +587,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充多边形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
public static void FillPolygon(this Graphics g, Color color, PointF[] points, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -291,6 +604,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充多边形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 填充模式
+ /// 平滑
public static void FillPolygon(this Graphics g, Color color, PointF[] points, FillMode fillMode, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -301,6 +622,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充多边形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
public static void FillPolygon(this Graphics g, Color color, Point[] points, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -311,6 +639,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充多边形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 填充模式
+ /// 平滑
public static void FillPolygon(this Graphics g, Color color, Point[] points, FillMode fillMode, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -321,6 +657,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制多边形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawPolygon(this Graphics g, Color color, PointF[] points, bool smooth = true, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -331,6 +675,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制多边形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点列表
+ /// 平滑
+ /// 笔宽
public static void DrawPolygon(this Graphics g, Color color, Point[] points, bool smooth = true, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -341,6 +693,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
public static void FillEllipse(this Graphics g, Color color, Rectangle rect, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -351,6 +710,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
+ /// 笔宽
public static void DrawEllipse(this Graphics g, Color color, Rectangle rect, bool smooth = true, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -361,6 +728,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
public static void FillEllipse(this Graphics g, Color color, RectangleF rect, bool smooth = true)
{
using (SolidBrush sb = color.Brush())
@@ -371,6 +745,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
+ /// 笔宽
public static void DrawEllipse(this Graphics g, Color color, RectangleF rect, bool smooth = true, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -381,20 +763,67 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
public static void FillEllipse(this Graphics g, Color color, int left, int top, int width, int height, bool smooth = true)
=> g.FillEllipse(color, new Rectangle(left, top, width, height), smooth);
+ ///
+ /// 绘制椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
+ /// 笔宽
public static void DrawEllipse(this Graphics g, Color color, int left, int top, int width, int height, bool smooth = true, float penWidth = 1)
=> g.DrawEllipse(color, new Rectangle(left, top, width, height), smooth, penWidth);
-
+ ///
+ /// 填充椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
public static void FillEllipse(this Graphics g, Color color, float left, float top, float width, float height, bool smooth = true)
=> g.FillEllipse(color, new RectangleF(left, top, width, height), smooth);
-
+ ///
+ /// 绘制椭圆
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
+ /// 笔宽
public static void DrawEllipse(this Graphics g, Color color, float left, float top, float width, float height, bool smooth = true, float penWidth = 1)
=> g.DrawEllipse(color, new RectangleF(left, top, width, height), smooth, penWidth);
+ ///
+ /// 填充矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
public static void FillRectangle(this Graphics g, Color color, Rectangle rect, bool smooth = false)
{
using (SolidBrush sb = color.Brush())
@@ -405,6 +834,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
+ /// 笔宽
public static void DrawRectangle(this Graphics g, Color color, Rectangle rect, bool smooth = false, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -415,6 +852,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
public static void FillRectangle(this Graphics g, Color color, RectangleF rect, bool smooth = false)
{
using (SolidBrush sb = color.Brush())
@@ -425,6 +869,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 平滑
+ /// 笔宽
public static void DrawRectangle(this Graphics g, Color color, RectangleF rect, bool smooth = false, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -435,21 +887,67 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
public static void FillRectangle(this Graphics g, Color color, int left, int top, int width, int height, bool smooth = false)
=> g.FillRectangle(color, new Rectangle(left, top, width, height), smooth);
+ ///
+ /// 绘制矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
+ /// 笔宽
public static void DrawRectangle(this Graphics g, Color color, int left, int top, int width, int height, bool smooth = false, float penWidth = 1)
=> g.DrawRectangle(color, new Rectangle(left, top, width, height), smooth, penWidth);
-
+ ///
+ /// 填充矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
public static void FillRectangle(this Graphics g, Color color, float left, float top, float width, float height, bool smooth = false)
=> g.FillRectangle(color, new RectangleF(left, top, width, height), smooth);
-
+ ///
+ /// 绘制矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 平滑
+ /// 笔宽
public static void DrawRectangle(this Graphics g, Color color, float left, float top, float width, float height, bool smooth = false, float penWidth = 1)
=> g.DrawRectangle(color, new RectangleF(left, top, width, height), smooth, penWidth);
-
+ ///
+ /// 填充矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 多个矩形
+ /// 平滑
public static void FillRectangles(this Graphics g, Color color, Rectangle[] rects, bool smooth = false)
{
using (SolidBrush sb = color.Brush())
@@ -460,6 +958,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充多个矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 多个矩形
+ /// 平滑
public static void FillRectangles(this Graphics g, Color color, RectangleF[] rects, bool smooth = false)
{
using (SolidBrush sb = color.Brush())
@@ -470,6 +975,13 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制图形形状
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 图形形状
+ /// 平滑
public static void FillRegion(this Graphics g, Color color, Region region, bool smooth = false)
{
using (SolidBrush sb = color.Brush())
@@ -480,7 +992,14 @@ namespace Sunny.UI
}
}
-
+ ///
+ /// 绘制多个矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 多个矩形
+ /// 平滑
+ /// 笔宽
public static void DrawRectangles(this Graphics g, Color color, Rectangle[] rects, bool smooth = false, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -491,6 +1010,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制多个矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 多个矩形
+ /// 平滑
+ /// 笔宽
public static void DrawRectangles(this Graphics g, Color color, RectangleF[] rects, bool smooth = false, float penWidth = 1)
{
using (Pen pn = color.Pen(penWidth))
@@ -501,6 +1028,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制圆角矩形
+ ///
+ /// 绘图图元
+ /// 画笔
+ /// 区域
+ /// 圆角大小
+ /// 平滑
public static void DrawRoundRectangle(this Graphics g, Pen pen, Rectangle rect, int cornerRadius, bool smooth = true)
{
g.Smooth(smooth);
@@ -519,6 +1054,14 @@ namespace Sunny.UI
g.Smooth(false);
}
+ ///
+ /// 填充圆角矩形
+ ///
+ /// 绘图图元
+ /// 画刷
+ /// 区域
+ /// 圆角大小
+ /// 平滑
public static void FillRoundRectangle(this Graphics g, Brush brush, Rectangle rect, int cornerRadius, bool smooth = true)
{
g.Smooth(smooth);
@@ -537,16 +1080,47 @@ namespace Sunny.UI
g.Smooth(false);
}
+ ///
+ /// 绘制圆角矩形
+ ///
+ /// 绘图图元
+ /// 画笔
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 圆角大小
+ /// 平滑
public static void DrawRoundRectangle(this Graphics g, Pen pen, int left, int top, int width, int height, int cornerRadius, bool smooth = true)
{
g.DrawRoundRectangle(pen, new Rectangle(left, top, width, height), cornerRadius, smooth);
}
+ ///
+ /// 填充圆角矩形
+ ///
+ /// 绘图图元
+ /// 画刷
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 圆角大小
+ /// 平滑
public static void FillRoundRectangle(this Graphics g, Brush brush, int left, int top, int width, int height, int cornerRadius, bool smooth = true)
{
g.FillRoundRectangle(brush, new Rectangle(left, top, width, height), cornerRadius, smooth);
}
+ ///
+ /// 绘制圆角矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 圆角大小
+ /// 平滑
+ /// 笔宽
public static void DrawRoundRectangle(this Graphics g, Color color, Rectangle rect, int cornerRadius, bool smooth = true, float penWidth = 1)
{
if (cornerRadius > 0)
@@ -562,6 +1136,14 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充圆角矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 圆角大小
+ /// 平滑
public static void FillRoundRectangle(this Graphics g, Color color, Rectangle rect, int cornerRadius, bool smooth = true)
{
if (cornerRadius > 0)
@@ -577,18 +1159,61 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制圆角矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 圆角大小
+ /// 平滑
+ /// 笔宽
public static void DrawRoundRectangle(this Graphics g, Color color, int left, int top, int width, int height, int cornerRadius, bool smooth = true, float penWidth = 1)
=> g.DrawRoundRectangle(color, new Rectangle(left, top, width, height), cornerRadius, smooth, penWidth);
+ ///
+ /// 填充圆角矩形
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 左边距
+ /// 顶边距
+ /// 宽度
+ /// 高度
+ /// 圆角大小
+ /// 平滑
public static void FillRoundRectangle(this Graphics g, Color color, int left, int top, int width, int height, int cornerRadius, bool smooth = true)
=> g.FillRoundRectangle(color, new Rectangle(left, top, width, height), cornerRadius, smooth);
+ ///
+ /// 绘制十字线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 中心点
+ /// 十字线大小
+ /// 笔宽
public static void DrawCross(this Graphics g, Color color, Point center, int crossSize = 3, float penWidth = 1)
{
g.DrawLine(color, center.X - crossSize, center.Y, center.X + crossSize, center.Y, false, penWidth);
g.DrawLine(color, center.X, center.Y - crossSize, center.X, center.Y + crossSize, false, penWidth);
}
+ ///
+ /// 绘制扇面区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 中心点
+ /// 距离1
+ /// 距离2
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawFan(this Graphics g, Color color, Point center, float d1, float d2, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
{
if (d1.Equals(0))
@@ -603,6 +1228,18 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制扇面区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 中心点
+ /// 距离1
+ /// 距离2
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawFan(this Graphics g, Color color, PointF center, float d1, float d2, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
{
if (d1.Equals(0))
@@ -617,6 +1254,17 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充扇面区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 中心点
+ /// 距离1
+ /// 距离2
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
public static void FillFan(this Graphics g, Color color, Point center, float d1, float d2, float startAngle, float sweepAngle, bool smooth = true)
{
if (d1.Equals(0))
@@ -631,6 +1279,17 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充扇面区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 中心点
+ /// 距离1
+ /// 距离2
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
public static void FillFan(this Graphics g, Color color, PointF center, float d1, float d2, float startAngle, float sweepAngle, bool smooth = true)
{
if (d1.Equals(0))
@@ -645,6 +1304,18 @@ namespace Sunny.UI
}
}
+ ///
+ /// 填充扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 宽度
+ /// 高度
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
public static void FillPie(this Graphics g, Color color, int x, int y, int width, int height, float startAngle, float sweepAngle, bool smooth = true)
{
g.Smooth(smooth);
@@ -656,9 +1327,30 @@ namespace Sunny.UI
g.Smooth(false);
}
+ ///
+ /// 填充扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
public static void FillPie(this Graphics g, Color color, Rectangle rect, float startAngle, float sweepAngle, bool smooth = true)
=> g.FillPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth);
+ ///
+ /// 填充扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 宽度
+ /// 高度
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
public static void FillPie(this Graphics g, Color color, float x, float y, float width, float height, float startAngle, float sweepAngle, bool smooth = true)
{
g.Smooth(smooth);
@@ -670,24 +1362,86 @@ namespace Sunny.UI
g.Smooth(false);
}
+ ///
+ /// 填充扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
public static void FillPie(this Graphics g, Color color, RectangleF rect, float startAngle, float sweepAngle, bool smooth = true)
=> g.FillPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth);
+ ///
+ /// 绘制点
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 大小
public static void DrawPoint(this Graphics g, Color color, int x, int y, float size)
=> g.FillEllipse(color, x - size / 2.0f, y - size / 2.0f, size, size);
+ ///
+ /// 绘制点
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 大小
public static void DrawPoint(this Graphics g, Color color, float x, float y, float size)
=> g.FillEllipse(color, x - size / 2.0f, y - size / 2.0f, size, size);
+ ///
+ /// 绘制点
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点
+ /// 大小
public static void DrawPoint(this Graphics g, Color color, Point point, float size)
=> g.DrawPoint(color, point.X, point.Y, size);
+ ///
+ /// 绘制点
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点
+ /// 大小
public static void DrawPoint(this Graphics g, Color color, PointF point, float size)
=> g.DrawPoint(color, point.X, point.Y, size);
+ ///
+ /// 绘制扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawPie(this Graphics g, Color color, Rectangle rect, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
=> g.DrawPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth, penWidth);
+ ///
+ /// 绘制扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 宽度
+ /// 高度
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawPie(this Graphics g, Color color, float x, float y, float width, float height, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
{
g.Smooth(smooth);
@@ -699,9 +1453,32 @@ namespace Sunny.UI
g.Smooth(false);
}
+ ///
+ /// 绘制扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 区域
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawPie(this Graphics g, Color color, RectangleF rect, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
=> g.DrawPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth, penWidth);
+ ///
+ /// 绘制扇形区域
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 水平位置
+ /// 垂直位置
+ /// 宽度
+ /// 高度
+ /// 起始角度
+ /// 扫过角度
+ /// 平滑
+ /// 笔宽
public static void DrawPie(this Graphics g, Color color, int x, int y, int width, int height, float startAngle, float sweepAngle, bool smooth = true, float penWidth = 1)
{
g.Smooth(smooth);
@@ -717,10 +1494,10 @@ namespace Sunny.UI
/// 九宫切图背景填充,#,http://st233.com/blog.php?id=24
/// 例如按钮是图片分成九个区域 然后只需要将四角填充到目标区域 其余的拉伸就可以了
///
- ///
- ///
- ///
- ///
+ /// 绘图图元
+ /// 图片
+ /// 区域
+ /// 角度
public static void DrawImageWithNineCut(this Graphics g, Image img, Rectangle rect, int angleSize = 5)
{
//填充四个角
@@ -747,6 +1524,18 @@ namespace Sunny.UI
new Rectangle(angleSize, angleSize, img.Width - angleSize * 2, img.Height - angleSize * 2), GraphicsUnit.Pixel);
}
+ ///
+ /// 九宫切图背景填充
+ ///
+ /// 绘图图元
+ /// 图片
+ /// 目标宽度
+ /// 目标高度
+ /// 裁剪左侧大小
+ /// 裁剪右侧大小
+ /// 裁剪顶部大小
+ /// 裁剪底部大小
+ /// 缩放比例
public static void DrawImageWithNineCut(this Graphics g, Image img, int destWidth, int destHeight, int cutLeft, int cutRight, int cutTop, int cutBottom, int iZoom = 1)
{
iZoom = Math.Max(1, iZoom);
@@ -776,6 +1565,16 @@ namespace Sunny.UI
new Rectangle(cutLeft, cutTop, img.Width - cutLeft - cutRight, img.Height - cutTop - cutBottom), GraphicsUnit.Pixel);
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 字符串
+ /// 字体
+ /// 颜色
+ /// 大小
+ /// 边距
+ /// 位置位置
public static void DrawString(this Graphics g, string str, Font font, Color color, Size size, Padding padding, ContentAlignment align)
{
if (str.IsNullOrEmpty()) return;
@@ -824,6 +1623,16 @@ namespace Sunny.UI
}
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 区域
+ /// 格式
+ /// 角度
public static void DrawString(this Graphics g, string text, Font font, Color color, RectangleF rect, StringFormat format, float angle)
{
if (text.IsNullOrEmpty()) return;
@@ -837,7 +1646,7 @@ namespace Sunny.UI
///
/// 以文字中心点为原点,旋转文字
///
- /// Graphics
+ /// 绘图图元
/// 文字
/// 字体
/// 颜色
@@ -855,7 +1664,7 @@ namespace Sunny.UI
///
/// 以文字中心点为原点,旋转文字
///
- /// Graphics
+ /// 绘图图元
/// 文字
/// 字体
/// 笔刷
@@ -885,7 +1694,7 @@ namespace Sunny.UI
///
/// 以旋转点为原点,旋转文字
///
- /// Graphics
+ /// 绘图图元
/// 文本
/// 字体
/// 填充
@@ -908,6 +1717,16 @@ namespace Sunny.UI
g.Transform = mtxSave;
}
+ ///
+ /// 绘制字符串
+ ///
+ /// 绘图图元
+ /// 文字
+ /// 字体
+ /// 颜色
+ /// 旋转点
+ /// 格式
+ /// 角度
public static void DrawString(this Graphics g, string text, Font font, Color color, PointF rotatePoint, StringFormat format, float angle)
{
if (text.IsNullOrEmpty()) return;
@@ -920,7 +1739,7 @@ namespace Sunny.UI
///
/// 绘制根据矩形旋转文本
///
- /// Graphics
+ /// 绘图图元
/// 文本
/// 字体
/// 填充
@@ -933,12 +1752,31 @@ namespace Sunny.UI
g.DrawStringRotateAtCenter(text, font, brush, rect.Center(), angle);
}
+ ///
+ /// 绘制两点连线
+ ///
+ /// 绘图图元
+ /// 颜色
+ /// 点1
+ /// 点2
+ /// 区域
+ /// 平滑
+ /// 笔宽
public static void DrawTwoPoints(this Graphics g, Color color, PointF pf1, PointF pf2, Rectangle rect, bool smooth = true, float penWidth = 1)
{
using Pen pen = color.Pen(penWidth);
DrawTwoPoints(g, pen, pf1, pf2, rect, smooth);
}
+ ///
+ /// 绘制两点连线
+ ///
+ /// 绘图图元
+ /// 画笔
+ /// 点1
+ /// 点2
+ /// 区域
+ /// 平滑
public static void DrawTwoPoints(this Graphics g, Pen pen, PointF pf1, PointF pf2, Rectangle rect, bool smooth = true)
{
if (pf1.X.IsNan() || pf1.Y.IsNan() || pf2.X.IsNan() || pf2.Y.IsNan()) return;
@@ -1081,7 +1919,7 @@ namespace Sunny.UI
///
/// 以center为中心,绘制箭头,正北0°,顺时针0°到359°
///
- /// Graphics
+ /// 绘图图元
/// 颜色
/// 中心点
/// 箭头尺寸
diff --git a/SunnyUI/Forms/UIMessageForm.cs b/SunnyUI/Forms/UIMessageForm.cs
index 17d03662..59da8322 100644
--- a/SunnyUI/Forms/UIMessageForm.cs
+++ b/SunnyUI/Forms/UIMessageForm.cs
@@ -28,6 +28,9 @@ namespace Sunny.UI
{
public sealed partial class UIMessageForm : UIForm
{
+ ///
+ /// 消息提示窗体
+ ///
public UIMessageForm()
{
InitializeComponent();
@@ -36,6 +39,9 @@ namespace Sunny.UI
btnCancel.Text = UILocalize.Cancel;
}
+ ///
+ /// 是否OK
+ ///
public bool IsOK
{
get; private set;
@@ -43,6 +49,9 @@ namespace Sunny.UI
private bool _showCancel = true;
+ ///
+ /// 显示取消按钮
+ ///
public bool ShowCancel
{
get => _showCancel;
@@ -84,6 +93,9 @@ namespace Sunny.UI
btnCancel.Left = btnOK.Right - 1;
}
+ ///
+ /// 回车事件
+ ///
protected override void DoEnter()
{
base.DoEnter();
@@ -144,6 +156,13 @@ namespace Sunny.UI
//((UIButton)sender).RadiusSides = UICornerRadiusSides.None;
}
+ ///
+ /// 显示消息提示窗体
+ ///
+ /// 消息
+ /// 标题
+ /// 显示取消按钮
+ /// 主题风格
public void ShowMessage(string message, string title, bool showCancel, UIStyle style = UIStyle.Blue)
{
Style = style;
diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj
index f22df4a8..ffb94d0e 100644
--- a/SunnyUI/SunnyUI.csproj
+++ b/SunnyUI/SunnyUI.csproj
@@ -17,7 +17,7 @@
https://gitee.com/yhuse/SunnyUI
False
SunnyUI.png
- True
+ False
D:\MyDocuments\SunnyUI.pfx
False
True