diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index f39c27d7..45d9edf8 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 21fd90f8..11e75718 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index 2e4d049e..6ac054b3 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index f39c27d7..45d9edf8 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/FMain.Designer.cs b/SunnyUI.Demo/FMain.Designer.cs index c5f66b20..6699f4f9 100644 --- a/SunnyUI.Demo/FMain.Designer.cs +++ b/SunnyUI.Demo/FMain.Designer.cs @@ -99,6 +99,7 @@ this.ClientSize = new System.Drawing.Size(1024, 720); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "FMain"; + this.ShowRadius = false; this.Text = "SunnyUI.Net"; this.WindowStateChange += new Sunny.UI.UIForm.OnWindowStateChange(this.FMain_WindowStateChange); this.Header.ResumeLayout(false); diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 20bff713..f36899a3 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -798,7 +798,10 @@ namespace Sunny.UI { if (InControlBox) { - e.Graphics.FillRoundRectangle(UIColor.Red, ControlBoxRect, 5); + if (ShowRadius) + e.Graphics.FillRoundRectangle(UIColor.Red, ControlBoxRect, 5); + else + e.Graphics.FillRectangle(UIColor.Red, ControlBoxRect); } //e.Graphics.DrawFontImage(61453, 24, Color.White, ControlBoxRect, 1); @@ -819,7 +822,10 @@ namespace Sunny.UI { if (InMaxBox) { - e.Graphics.FillRoundRectangle(btn.FillHoverColor, MaximizeBoxRect, 5); + if (ShowRadius) + e.Graphics.FillRoundRectangle(btn.FillHoverColor, MaximizeBoxRect, 5); + else + e.Graphics.FillRectangle(btn.FillHoverColor, MaximizeBoxRect); } // e.Graphics.DrawFontImage( @@ -872,7 +878,10 @@ namespace Sunny.UI { if (InMinBox) { - e.Graphics.FillRoundRectangle(btn.FillHoverColor, MinimizeBoxRect, 5); + if (ShowRadius) + e.Graphics.FillRoundRectangle(btn.FillHoverColor, MinimizeBoxRect, 5); + else + e.Graphics.FillRectangle(btn.FillHoverColor, MinimizeBoxRect); } e.Graphics.DrawLine(Color.White, diff --git a/SunnyUI/Static/UGDI.cs b/SunnyUI/Static/UGDI.cs index d8e5c32b..6eec087f 100644 --- a/SunnyUI/Static/UGDI.cs +++ b/SunnyUI/Static/UGDI.cs @@ -381,20 +381,38 @@ namespace Sunny.UI public static void DrawRoundRectangle(this Graphics g, Pen pen, Rectangle rect, int cornerRadius, bool smooth = true) { - using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + if (cornerRadius > 0) + { + using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + { + g.Smooth(smooth); + g.DrawPath(pen, path); + g.Smooth(false); + } + } + else { g.Smooth(smooth); - g.DrawPath(pen, path); + g.DrawRectangle(pen, rect); g.Smooth(false); } } public static void FillRoundRectangle(this Graphics g, Brush brush, Rectangle rect, int cornerRadius, bool smooth = true) { - using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + if (cornerRadius > 0) + { + using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + { + g.Smooth(smooth); + g.FillPath(brush, path); + g.Smooth(false); + } + } + else { g.Smooth(smooth); - g.FillPath(brush, path); + g.FillRectangle(brush, rect); g.Smooth(false); } } @@ -411,17 +429,31 @@ namespace Sunny.UI public static void DrawRoundRectangle(this Graphics g, Color color, Rectangle rect, int cornerRadius, bool smooth = true) { - using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + if (cornerRadius > 0) { - g.DrawPath(color, path, smooth); + using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + { + g.DrawPath(color, path, smooth); + } + } + else + { + g.DrawRectangle(color, rect, smooth); } } public static void FillRoundRectangle(this Graphics g, Color color, Rectangle rect, int cornerRadius, bool smooth = true) { - using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + if (cornerRadius > 0) { - g.FillPath(color, path, smooth); + using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius)) + { + g.FillPath(color, path, smooth); + } + } + else + { + g.FillRectangle(color, rect, smooth); } } @@ -482,7 +514,7 @@ namespace Sunny.UI public static GraphicsPath CreateFanPath(this Point center, float d1, float d2, float startAngle, float sweepAngle) { - return new PointF(center.X,center.Y).CreateFanPath(d1,d2,startAngle,sweepAngle); + return new PointF(center.X, center.Y).CreateFanPath(d1, d2, startAngle, sweepAngle); } public static GraphicsPath CreateFanPath(this PointF center, float d1, float d2, float startAngle, float sweepAngle) @@ -666,12 +698,12 @@ namespace Sunny.UI } } - public static void DrawString(this Graphics g, string s, Font font, Color color, + public static void DrawString(this Graphics g, string s, Font font, Color color, RectangleF layoutRectangle, StringFormat format, float angle) { - using (Brush br= new SolidBrush(color)) + using (Brush br = new SolidBrush(color)) { - g.DrawString(s,font,br,layoutRectangle,format,angle); + g.DrawString(s, font, br, layoutRectangle, format, angle); } } @@ -680,7 +712,7 @@ namespace Sunny.UI { using (Brush br = new SolidBrush(color)) { - g.DrawString(s,font,br,point,format,angle); + g.DrawString(s, font, br, point, format, angle); } }