diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index d8d91ad8..379a6721 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 0e860f1d..ad3102c6 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net45/SunnyUI.dll b/Bin/net45/SunnyUI.dll index 8b1b4ad6..26936b88 100644 Binary files a/Bin/net45/SunnyUI.dll and b/Bin/net45/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index 65c68196..e0cf9d0c 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index b227cfed..699ef11a 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index 2176bf6f..e823c973 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FPipe.cs b/SunnyUI.Demo/Controls/FPipe.cs new file mode 100644 index 00000000..8880666e --- /dev/null +++ b/SunnyUI.Demo/Controls/FPipe.cs @@ -0,0 +1,37 @@ +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace Sunny.UI.Demo +{ + public partial class FPipe : UIPage + { + public FPipe() + { + InitializeComponent(); + timer1.Start(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + Color[] surroundColor = new Color[] { Color.Silver }; + GraphicsPath CirclePath = new GraphicsPath(); + CirclePath.AddEllipse(0, 0, 36, 38); + PathGradientBrush gradientBrush = new PathGradientBrush(CirclePath); + gradientBrush.CenterPoint = new PointF(18, 18); + gradientBrush.CenterColor = Color.White; + gradientBrush.SurroundColors = surroundColor; + e.Graphics.SetHighQuality(); + e.Graphics.FillPath(gradientBrush, CirclePath); + e.Graphics.SetDefaultQuality(); + } + + private void timer1_Tick(object sender, System.EventArgs e) + { + foreach (var pipe in this.GetControls()) + { + pipe.Invalidate(); + } + } + } +} diff --git a/SunnyUI.Demo/Controls/FPipe.designer.cs b/SunnyUI.Demo/Controls/FPipe.designer.cs new file mode 100644 index 00000000..382de4e2 --- /dev/null +++ b/SunnyUI.Demo/Controls/FPipe.designer.cs @@ -0,0 +1,542 @@ + +namespace Sunny.UI.Demo +{ + partial class FPipe + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.uiPipe3 = new Sunny.UI.UIPipe(); + this.uiPipe4 = new Sunny.UI.UIPipe(); + this.uiPipe2 = new Sunny.UI.UIPipe(); + this.uiPipe7 = new Sunny.UI.UIPipe(); + this.uiPipe8 = new Sunny.UI.UIPipe(); + this.uiPipe9 = new Sunny.UI.UIPipe(); + this.uiPipe10 = new Sunny.UI.UIPipe(); + this.uiPipe11 = new Sunny.UI.UIPipe(); + this.uiPipe12 = new Sunny.UI.UIPipe(); + this.uiPipe1 = new Sunny.UI.UIPipe(); + this.uiPipe5 = new Sunny.UI.UIPipe(); + this.uiPipe6 = new Sunny.UI.UIPipe(); + this.uiPipe13 = new Sunny.UI.UIPipe(); + this.uiPipe14 = new Sunny.UI.UIPipe(); + this.uiPipe15 = new Sunny.UI.UIPipe(); + this.uiPipe16 = new Sunny.UI.UIPipe(); + this.uiPipe17 = new Sunny.UI.UIPipe(); + this.uiPipe18 = new Sunny.UI.UIPipe(); + this.SuspendLayout(); + // + // timer1 + // + this.timer1.Interval = 200; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // uiPipe3 + // + this.uiPipe3.Active = true; + this.uiPipe3.BackColor = System.Drawing.Color.Transparent; + this.uiPipe3.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe3.FillColor = System.Drawing.Color.White; + this.uiPipe3.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128))))); + this.uiPipe3.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe3.FlowInterval = 22; + this.uiPipe3.FlowSize = 35; + this.uiPipe3.FlowSpeed = 10; + this.uiPipe3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe3.Location = new System.Drawing.Point(196, 194); + this.uiPipe3.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe3.Name = "uiPipe3"; + this.uiPipe3.Radius = 16; + this.uiPipe3.RadiusSides = Sunny.UI.UICornerRadiusSides.RightTop; + this.uiPipe3.RectColor = System.Drawing.Color.Silver; + this.uiPipe3.Size = new System.Drawing.Size(16, 234); + this.uiPipe3.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe3.StyleCustomMode = true; + this.uiPipe3.TabIndex = 9; + this.uiPipe3.Text = "uiPipe3"; + // + // uiPipe4 + // + this.uiPipe4.Active = true; + this.uiPipe4.BackColor = System.Drawing.Color.Transparent; + this.uiPipe4.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe4.FillColor = System.Drawing.Color.White; + this.uiPipe4.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128))))); + this.uiPipe4.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe4.FlowInterval = 22; + this.uiPipe4.FlowSize = 35; + this.uiPipe4.FlowSpeed = 10; + this.uiPipe4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe4.Location = new System.Drawing.Point(34, 63); + this.uiPipe4.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe4.Name = "uiPipe4"; + this.uiPipe4.Radius = 15; + this.uiPipe4.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe4.RectColor = System.Drawing.Color.Silver; + this.uiPipe4.Size = new System.Drawing.Size(15, 365); + this.uiPipe4.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe4.StyleCustomMode = true; + this.uiPipe4.TabIndex = 8; + this.uiPipe4.Text = "uiPipe4"; + // + // uiPipe2 + // + this.uiPipe2.Active = true; + this.uiPipe2.BackColor = System.Drawing.Color.Transparent; + this.uiPipe2.FillColor = System.Drawing.Color.White; + this.uiPipe2.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128))))); + this.uiPipe2.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe2.FlowInterval = 22; + this.uiPipe2.FlowSize = 35; + this.uiPipe2.FlowSpeed = 10; + this.uiPipe2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe2.Location = new System.Drawing.Point(48, 194); + this.uiPipe2.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe2.Name = "uiPipe2"; + this.uiPipe2.Radius = 16; + this.uiPipe2.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe2.RectColor = System.Drawing.Color.Silver; + this.uiPipe2.Size = new System.Drawing.Size(149, 16); + this.uiPipe2.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe2.StyleCustomMode = true; + this.uiPipe2.TabIndex = 5; + this.uiPipe2.Text = "uiPipe2"; + // + // uiPipe7 + // + this.uiPipe7.Active = true; + this.uiPipe7.BackColor = System.Drawing.Color.Transparent; + this.uiPipe7.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe7.FillColor = System.Drawing.Color.White; + this.uiPipe7.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe7.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe7.FlowInterval = 22; + this.uiPipe7.FlowSize = 35; + this.uiPipe7.FlowSpeed = 10; + this.uiPipe7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe7.Location = new System.Drawing.Point(451, 194); + this.uiPipe7.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe7.Name = "uiPipe7"; + this.uiPipe7.Radius = 16; + this.uiPipe7.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.RightTop | Sunny.UI.UICornerRadiusSides.RightBottom))); + this.uiPipe7.RectColor = System.Drawing.Color.Silver; + this.uiPipe7.Size = new System.Drawing.Size(16, 73); + this.uiPipe7.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe7.StyleCustomMode = true; + this.uiPipe7.TabIndex = 14; + this.uiPipe7.Text = "uiPipe7"; + // + // uiPipe8 + // + this.uiPipe8.Active = true; + this.uiPipe8.BackColor = System.Drawing.Color.Transparent; + this.uiPipe8.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe8.FillColor = System.Drawing.Color.White; + this.uiPipe8.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe8.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe8.FlowInterval = 22; + this.uiPipe8.FlowSize = 35; + this.uiPipe8.FlowSpeed = 10; + this.uiPipe8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe8.Location = new System.Drawing.Point(289, 63); + this.uiPipe8.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe8.Name = "uiPipe8"; + this.uiPipe8.Radius = 15; + this.uiPipe8.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe8.RectColor = System.Drawing.Color.Silver; + this.uiPipe8.Size = new System.Drawing.Size(15, 365); + this.uiPipe8.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe8.StyleCustomMode = true; + this.uiPipe8.TabIndex = 13; + this.uiPipe8.Text = "uiPipe8"; + // + // uiPipe9 + // + this.uiPipe9.Active = true; + this.uiPipe9.BackColor = System.Drawing.Color.Transparent; + this.uiPipe9.FillColor = System.Drawing.Color.White; + this.uiPipe9.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe9.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe9.FlowInterval = 22; + this.uiPipe9.FlowSize = 35; + this.uiPipe9.FlowSpeed = 10; + this.uiPipe9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe9.Location = new System.Drawing.Point(303, 194); + this.uiPipe9.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe9.Name = "uiPipe9"; + this.uiPipe9.Radius = 16; + this.uiPipe9.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe9.RectColor = System.Drawing.Color.Silver; + this.uiPipe9.Size = new System.Drawing.Size(149, 16); + this.uiPipe9.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe9.StyleCustomMode = true; + this.uiPipe9.TabIndex = 12; + this.uiPipe9.Text = "uiPipe9"; + // + // uiPipe10 + // + this.uiPipe10.Active = true; + this.uiPipe10.BackColor = System.Drawing.Color.Transparent; + this.uiPipe10.FillColor = System.Drawing.Color.White; + this.uiPipe10.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe10.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Reverse; + this.uiPipe10.FlowInterval = 22; + this.uiPipe10.FlowSize = 35; + this.uiPipe10.FlowSpeed = 10; + this.uiPipe10.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe10.Location = new System.Drawing.Point(78, 251); + this.uiPipe10.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe10.Name = "uiPipe10"; + this.uiPipe10.Radius = 16; + this.uiPipe10.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe10.RectColor = System.Drawing.Color.Silver; + this.uiPipe10.Size = new System.Drawing.Size(389, 16); + this.uiPipe10.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe10.StyleCustomMode = true; + this.uiPipe10.TabIndex = 15; + this.uiPipe10.Text = "uiPipe10"; + // + // uiPipe11 + // + this.uiPipe11.Active = true; + this.uiPipe11.BackColor = System.Drawing.Color.Transparent; + this.uiPipe11.FillColor = System.Drawing.Color.White; + this.uiPipe11.FlowColor = System.Drawing.Color.SkyBlue; + this.uiPipe11.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Reverse; + this.uiPipe11.FlowInterval = 22; + this.uiPipe11.FlowSize = 35; + this.uiPipe11.FlowSpeed = 10; + this.uiPipe11.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe11.Location = new System.Drawing.Point(109, 295); + this.uiPipe11.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe11.Name = "uiPipe11"; + this.uiPipe11.Radius = 16; + this.uiPipe11.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe11.RectColor = System.Drawing.Color.Silver; + this.uiPipe11.Size = new System.Drawing.Size(612, 16); + this.uiPipe11.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe11.StyleCustomMode = true; + this.uiPipe11.TabIndex = 16; + this.uiPipe11.Text = "uiPipe11"; + // + // uiPipe12 + // + this.uiPipe12.Active = true; + this.uiPipe12.BackColor = System.Drawing.Color.Transparent; + this.uiPipe12.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe12.FillColor = System.Drawing.Color.White; + this.uiPipe12.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe12.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe12.FlowInterval = 22; + this.uiPipe12.FlowSize = 35; + this.uiPipe12.FlowSpeed = 10; + this.uiPipe12.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe12.Location = new System.Drawing.Point(63, 251); + this.uiPipe12.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe12.Name = "uiPipe12"; + this.uiPipe12.Radius = 16; + this.uiPipe12.RadiusSides = Sunny.UI.UICornerRadiusSides.LeftTop; + this.uiPipe12.RectColor = System.Drawing.Color.Silver; + this.uiPipe12.Size = new System.Drawing.Size(16, 114); + this.uiPipe12.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe12.StyleCustomMode = true; + this.uiPipe12.TabIndex = 17; + this.uiPipe12.Text = "uiPipe12"; + // + // uiPipe1 + // + this.uiPipe1.Active = true; + this.uiPipe1.BackColor = System.Drawing.Color.Transparent; + this.uiPipe1.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe1.FillColor = System.Drawing.Color.White; + this.uiPipe1.FlowColor = System.Drawing.Color.SkyBlue; + this.uiPipe1.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe1.FlowInterval = 22; + this.uiPipe1.FlowSize = 35; + this.uiPipe1.FlowSpeed = 10; + this.uiPipe1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe1.Location = new System.Drawing.Point(94, 295); + this.uiPipe1.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe1.Name = "uiPipe1"; + this.uiPipe1.Radius = 16; + this.uiPipe1.RadiusSides = Sunny.UI.UICornerRadiusSides.LeftTop; + this.uiPipe1.RectColor = System.Drawing.Color.Silver; + this.uiPipe1.Size = new System.Drawing.Size(16, 70); + this.uiPipe1.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe1.StyleCustomMode = true; + this.uiPipe1.TabIndex = 18; + this.uiPipe1.Text = "uiPipe1"; + // + // uiPipe5 + // + this.uiPipe5.Active = true; + this.uiPipe5.BackColor = System.Drawing.Color.Transparent; + this.uiPipe5.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe5.FillColor = System.Drawing.Color.White; + this.uiPipe5.FlowColor = System.Drawing.Color.SkyBlue; + this.uiPipe5.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe5.FlowInterval = 22; + this.uiPipe5.FlowSize = 35; + this.uiPipe5.FlowSpeed = 10; + this.uiPipe5.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe5.Location = new System.Drawing.Point(720, 63); + this.uiPipe5.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe5.Name = "uiPipe5"; + this.uiPipe5.Radius = 16; + this.uiPipe5.RadiusSides = Sunny.UI.UICornerRadiusSides.RightBottom; + this.uiPipe5.RectColor = System.Drawing.Color.Silver; + this.uiPipe5.Size = new System.Drawing.Size(16, 248); + this.uiPipe5.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe5.StyleCustomMode = true; + this.uiPipe5.TabIndex = 19; + this.uiPipe5.Text = "uiPipe5"; + // + // uiPipe6 + // + this.uiPipe6.Active = true; + this.uiPipe6.BackColor = System.Drawing.Color.Transparent; + this.uiPipe6.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe6.FillColor = System.Drawing.Color.White; + this.uiPipe6.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.uiPipe6.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe6.FlowInterval = 16; + this.uiPipe6.FlowSize = 28; + this.uiPipe6.FlowSpeed = 20; + this.uiPipe6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe6.Location = new System.Drawing.Point(64, 391); + this.uiPipe6.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe6.Name = "uiPipe6"; + this.uiPipe6.Radius = 15; + this.uiPipe6.RadiusSides = Sunny.UI.UICornerRadiusSides.LeftBottom; + this.uiPipe6.RectColor = System.Drawing.Color.DarkGray; + this.uiPipe6.Size = new System.Drawing.Size(15, 156); + this.uiPipe6.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe6.StyleCustomMode = true; + this.uiPipe6.TabIndex = 20; + this.uiPipe6.Text = "uiPipe6"; + // + // uiPipe13 + // + this.uiPipe13.Active = true; + this.uiPipe13.BackColor = System.Drawing.Color.Transparent; + this.uiPipe13.FillColor = System.Drawing.Color.White; + this.uiPipe13.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.uiPipe13.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe13.FlowInterval = 16; + this.uiPipe13.FlowSize = 28; + this.uiPipe13.FlowSpeed = 20; + this.uiPipe13.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe13.Location = new System.Drawing.Point(78, 490); + this.uiPipe13.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe13.Name = "uiPipe13"; + this.uiPipe13.Radius = 16; + this.uiPipe13.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe13.RectColor = System.Drawing.Color.DarkGray; + this.uiPipe13.Size = new System.Drawing.Size(643, 16); + this.uiPipe13.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe13.StyleCustomMode = true; + this.uiPipe13.TabIndex = 21; + this.uiPipe13.Text = "uiPipe13"; + // + // uiPipe14 + // + this.uiPipe14.Active = true; + this.uiPipe14.BackColor = System.Drawing.Color.Transparent; + this.uiPipe14.FillColor = System.Drawing.Color.White; + this.uiPipe14.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.uiPipe14.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe14.FlowInterval = 16; + this.uiPipe14.FlowSize = 28; + this.uiPipe14.FlowSpeed = 20; + this.uiPipe14.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe14.Location = new System.Drawing.Point(78, 531); + this.uiPipe14.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe14.Name = "uiPipe14"; + this.uiPipe14.Radius = 16; + this.uiPipe14.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe14.RectColor = System.Drawing.Color.DarkGray; + this.uiPipe14.Size = new System.Drawing.Size(298, 16); + this.uiPipe14.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe14.StyleCustomMode = true; + this.uiPipe14.TabIndex = 22; + this.uiPipe14.Text = "uiPipe14"; + // + // uiPipe15 + // + this.uiPipe15.Active = true; + this.uiPipe15.BackColor = System.Drawing.Color.Transparent; + this.uiPipe15.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe15.FillColor = System.Drawing.Color.White; + this.uiPipe15.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); + this.uiPipe15.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Reverse; + this.uiPipe15.FlowInterval = 16; + this.uiPipe15.FlowSize = 28; + this.uiPipe15.FlowSpeed = 20; + this.uiPipe15.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe15.Location = new System.Drawing.Point(375, 391); + this.uiPipe15.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe15.Name = "uiPipe15"; + this.uiPipe15.Radius = 15; + this.uiPipe15.RadiusSides = Sunny.UI.UICornerRadiusSides.RightBottom; + this.uiPipe15.RectColor = System.Drawing.Color.DarkGray; + this.uiPipe15.Size = new System.Drawing.Size(15, 156); + this.uiPipe15.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe15.StyleCustomMode = true; + this.uiPipe15.TabIndex = 23; + this.uiPipe15.Text = "uiPipe15"; + // + // uiPipe16 + // + this.uiPipe16.Active = true; + this.uiPipe16.BackColor = System.Drawing.Color.Transparent; + this.uiPipe16.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe16.FillColor = System.Drawing.Color.White; + this.uiPipe16.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe16.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe16.FlowInterval = 16; + this.uiPipe16.FlowSize = 28; + this.uiPipe16.FlowSpeed = 20; + this.uiPipe16.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.uiPipe16.Location = new System.Drawing.Point(538, 391); + this.uiPipe16.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe16.Name = "uiPipe16"; + this.uiPipe16.Radius = 15; + this.uiPipe16.RadiusSides = Sunny.UI.UICornerRadiusSides.LeftBottom; + this.uiPipe16.RectColor = System.Drawing.Color.DarkGray; + this.uiPipe16.Size = new System.Drawing.Size(15, 83); + this.uiPipe16.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe16.StyleCustomMode = true; + this.uiPipe16.TabIndex = 24; + this.uiPipe16.Text = "uiPipe16"; + // + // uiPipe17 + // + this.uiPipe17.Active = true; + this.uiPipe17.BackColor = System.Drawing.Color.Transparent; + this.uiPipe17.FillColor = System.Drawing.Color.White; + this.uiPipe17.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe17.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe17.FlowInterval = 16; + this.uiPipe17.FlowSize = 28; + this.uiPipe17.FlowSpeed = 20; + this.uiPipe17.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.uiPipe17.Location = new System.Drawing.Point(552, 458); + this.uiPipe17.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe17.Name = "uiPipe17"; + this.uiPipe17.Radius = 16; + this.uiPipe17.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.uiPipe17.RectColor = System.Drawing.Color.DarkGray; + this.uiPipe17.Size = new System.Drawing.Size(169, 16); + this.uiPipe17.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe17.StyleCustomMode = true; + this.uiPipe17.TabIndex = 25; + this.uiPipe17.Text = "uiPipe17"; + // + // uiPipe18 + // + this.uiPipe18.Active = true; + this.uiPipe18.BackColor = System.Drawing.Color.Transparent; + this.uiPipe18.Direction = Sunny.UI.UILine.LineDirection.Vertical; + this.uiPipe18.FillColor = System.Drawing.Color.White; + this.uiPipe18.FlowColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.uiPipe18.FlowDirection = Sunny.UI.UIPipe.UIFlowDirection.Forward; + this.uiPipe18.FlowInterval = 16; + this.uiPipe18.FlowSize = 28; + this.uiPipe18.FlowSpeed = 20; + this.uiPipe18.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiPipe18.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.uiPipe18.Location = new System.Drawing.Point(717, 458); + this.uiPipe18.MinimumSize = new System.Drawing.Size(1, 1); + this.uiPipe18.Name = "uiPipe18"; + this.uiPipe18.Radius = 16; + this.uiPipe18.RadiusSides = Sunny.UI.UICornerRadiusSides.RightTop; + this.uiPipe18.RectColor = System.Drawing.Color.DarkGray; + this.uiPipe18.Size = new System.Drawing.Size(16, 89); + this.uiPipe18.Style = Sunny.UI.UIStyle.Custom; + this.uiPipe18.StyleCustomMode = true; + this.uiPipe18.TabIndex = 26; + this.uiPipe18.Text = "uiPipe18"; + // + // FPipe + // + this.AllowShowTitle = true; + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(855, 642); + this.Controls.Add(this.uiPipe18); + this.Controls.Add(this.uiPipe16); + this.Controls.Add(this.uiPipe15); + this.Controls.Add(this.uiPipe6); + this.Controls.Add(this.uiPipe5); + this.Controls.Add(this.uiPipe1); + this.Controls.Add(this.uiPipe12); + this.Controls.Add(this.uiPipe7); + this.Controls.Add(this.uiPipe8); + this.Controls.Add(this.uiPipe9); + this.Controls.Add(this.uiPipe3); + this.Controls.Add(this.uiPipe4); + this.Controls.Add(this.uiPipe2); + this.Controls.Add(this.uiPipe10); + this.Controls.Add(this.uiPipe11); + this.Controls.Add(this.uiPipe14); + this.Controls.Add(this.uiPipe17); + this.Controls.Add(this.uiPipe13); + this.Name = "FPipe"; + this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0); + this.ShowTitle = true; + this.Symbol = 61860; + this.Text = "Pipe"; + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Timer timer1; + private UIPipe uiPipe2; + private UIPipe uiPipe4; + private UIPipe uiPipe3; + private UIPipe uiPipe7; + private UIPipe uiPipe8; + private UIPipe uiPipe9; + private UIPipe uiPipe10; + private UIPipe uiPipe11; + private UIPipe uiPipe12; + private UIPipe uiPipe1; + private UIPipe uiPipe5; + private UIPipe uiPipe6; + private UIPipe uiPipe13; + private UIPipe uiPipe14; + private UIPipe uiPipe15; + private UIPipe uiPipe16; + private UIPipe uiPipe17; + private UIPipe uiPipe18; + } +} + diff --git a/SunnyUI.Demo/Controls/FPipe.resx b/SunnyUI.Demo/Controls/FPipe.resx new file mode 100644 index 00000000..1f666f26 --- /dev/null +++ b/SunnyUI.Demo/Controls/FPipe.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/SunnyUI.Demo/FMain.cs b/SunnyUI.Demo/FMain.cs index 4631245a..7776aa2a 100644 --- a/SunnyUI.Demo/FMain.cs +++ b/SunnyUI.Demo/FMain.cs @@ -14,7 +14,7 @@ namespace Sunny.UI.Demo int pageIndex = 1000; Header.SetNodePageIndex(Header.Nodes[0], pageIndex); Header.SetNodeSymbol(Header.Nodes[0], 61451); - TreeNode parent = Aside.CreateNode("Controls", 61451, 24, pageIndex); + TreeNode parent = Aside.CreateNode("控件", 61451, 24, pageIndex); //通过设置PageIndex关联 Aside.CreateChildNode(parent, 61640, 24, AddPage(new FButton(), ++pageIndex)); Aside.CreateChildNode(parent, 62141, 24, AddPage(new FHeaderButton(), ++pageIndex)); @@ -38,12 +38,15 @@ namespace Sunny.UI.Demo Aside.CreateChildNode(parent, AddPage(new FScrollBar(), ++pageIndex)); Aside.CreateChildNode(parent, 61668, 24, AddPage(new FMeter(), ++pageIndex)); Aside.CreateChildNode(parent, 62173, 24, AddPage(new FOther(), ++pageIndex)); + Aside.CreateChildNode(parent, AddPage(new FPipe())); + + Aside.ShowTips = true; Aside.SetNodeTipsText(parent.Nodes[0], "1"); pageIndex = 2000; Header.SetNodePageIndex(Header.Nodes[1], pageIndex); Header.SetNodeSymbol(Header.Nodes[1], 61818); - parent = Aside.CreateNode("Forms", 61818, 24, pageIndex); + parent = Aside.CreateNode("窗体", 61818, 24, pageIndex); //通过设置GUID关联,节点字体图标和大小由UIPage设置 Aside.CreateChildNode(parent, AddPage(new FDialogs(), Guid.NewGuid())); Aside.CreateChildNode(parent, AddPage(new FEditor(), Guid.NewGuid())); @@ -52,7 +55,7 @@ namespace Sunny.UI.Demo pageIndex = 3000; Header.SetNodePageIndex(Header.Nodes[2], pageIndex); Header.SetNodeSymbol(Header.Nodes[2], 61950); - parent = Aside.CreateNode("Charts", 61950, 24, pageIndex); + parent = Aside.CreateNode("图表", 61950, 24, pageIndex); //直接关联(默认自动生成GUID) Aside.CreateChildNode(parent, AddPage(new FPieChart())); Aside.CreateChildNode(parent, AddPage(new FDoughnutChart())); diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj index ad6083f2..81ee7ca2 100644 --- a/SunnyUI.Demo/SunnyUI.Demo.csproj +++ b/SunnyUI.Demo/SunnyUI.Demo.csproj @@ -123,6 +123,12 @@ FLine.cs + + Form + + + FPipe.cs + Form @@ -374,6 +380,9 @@ FLine.cs + + FPipe.cs + FTransfer.cs diff --git a/SunnyUI/Controls/UIPipe.cs b/SunnyUI/Controls/UIPipe.cs new file mode 100644 index 00000000..8222a04b --- /dev/null +++ b/SunnyUI/Controls/UIPipe.cs @@ -0,0 +1,447 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; + +namespace Sunny.UI +{ + [ToolboxItem(true)] + public class UIPipe : UIControl + { + public UIPipe() + { + SetStyleFlags(); + ShowText = false; + rectColor = Color.Silver; + fillColor = Color.White; + StyleCustomMode = true; + Style = UIStyle.Custom; + } + + private UILine.LineDirection direction = UILine.LineDirection.Horizontal; + + [DefaultValue(UILine.LineDirection.Horizontal)] + [Description("线条方向"), Category("SunnyUI")] + public UILine.LineDirection Direction + { + get => direction; + set + { + Radius = 0; + direction = value; + Invalidate(); + } + } + + /// + /// 边框颜色 + /// + [Description("边框颜色"), Category("SunnyUI")] + [DefaultValue(typeof(Color), "80, 160, 255")] + public Color RectColor + { + get => rectColor; + set => SetRectColor(value); + } + + /// + /// 填充颜色,当值为背景色或透明色或空值则不填充 + /// + [Description("填充颜色"), Category("SunnyUI")] + [DefaultValue(typeof(Color), "80, 160, 255")] + public Color FillColor + { + get => fillColor; + set => SetFillColor(value); + } + + public bool Active { get; set; } + + public UIFlowDirection FlowDirection + { + get; + set; + } + + public int flowSpeed = 6; + public int FlowSpeed + { + get => flowSpeed; + set => flowSpeed = Math.Max(value, 1); + } + + public Color FlowColor { get; set; } = Color.Purple; + + public int flowSize = 35; + public int FlowSize + { + get => flowSize; + set => flowSize = Math.Max(value, 10); + } + + public int flowInterval = 22; + public int FlowInterval + { + get => flowInterval; + set => flowInterval = Math.Max(value, 10); + } + + public enum UIFlowDirection + { + /// + /// 正向 + /// + Forward, + + /// + /// 反向 + /// + Reverse + } + + Color[] colors; + + protected override void OnPaintRect(Graphics g, GraphicsPath path) + { + base.OnPaintRect(g, path); + + if (Direction == UILine.LineDirection.Horizontal) return; + if (Height < Width * 2 + 4) return; + + if (RadiusSides.HasFlag(UICornerRadiusSides.LeftTop) && + !RadiusSides.HasFlag(UICornerRadiusSides.RightTop)) + { + for (int i = 0; i < Width; i++) + { + g.DrawLine(colors[i], Width - 1, i, Width, i); + } + } + + if (!RadiusSides.HasFlag(UICornerRadiusSides.LeftTop) && + RadiusSides.HasFlag(UICornerRadiusSides.RightTop)) + { + for (int i = 0; i < Width; i++) + { + int idx = Width - i; + if (idx >= 0 && idx < Width) + g.DrawLine(colors[idx], 0, i - 1, 1, i - 1); + } + } + + if (RadiusSides.HasFlag(UICornerRadiusSides.LeftBottom) && + !RadiusSides.HasFlag(UICornerRadiusSides.RightBottom)) + { + for (int i = 0; i < Width; i++) + { + g.DrawLine(colors[i], Width - 1, Height - i - 1, Width, Height - i - 1); + } + } + + if (!RadiusSides.HasFlag(UICornerRadiusSides.LeftBottom) && + RadiusSides.HasFlag(UICornerRadiusSides.RightBottom)) + { + for (int i = 0; i < Width; i++) + { + int idx = Width - i; + if (idx >= 0 && idx < Width) + g.DrawLine(colors[idx], 0, Height - i, 1, Height - i); + } + } + } + + protected override void OnPaintFill(Graphics g, GraphicsPath path) + { + base.OnPaintFill(g, path); + if (colors == null || colors.Length != Width) + colors = new Color[Width]; + + //水平的 + if (Direction == UILine.LineDirection.Horizontal) + { + if (Width > Height) + { + if (Radius != Height) + Radius = Height; + } + else + { + Radius = 0; + } + + int h = Height.Div(2) + Height.Mod(2); + using (Bitmap bmp = new Bitmap(Width, Height)) + using (Graphics g1 = bmp.Graphics()) + using (LinearGradientBrush lgb = new LinearGradientBrush(new Point(0, 0), + new Point(0, h), + rectColor, + fillColor)) + { + g1.SetHighQuality(); + g1.FillPath(lgb, path); + g1.SetDefaultQuality(); + g.DrawImage(bmp, new Rectangle(0, 0, Width, h), new Rectangle(0, 0, Width, h), GraphicsUnit.Pixel); + } + + using (Bitmap bmp = new Bitmap(Width, Height)) + using (Graphics g1 = bmp.Graphics()) + using (LinearGradientBrush lgb = new LinearGradientBrush(new Point(0, h - 1), + new Point(0, Height), + fillColor, + rectColor)) + { + g1.SetHighQuality(); + g1.FillPath(lgb, path); + g1.SetDefaultQuality(); + + g.DrawImage(bmp, new Rectangle(0, h, Width, Height - h), new Rectangle(0, h, Width, Height - h), GraphicsUnit.Pixel); + } + } + + //垂直的 + if (Direction == UILine.LineDirection.Vertical) + { + if (Height > Width) + { + if (Radius != Width) + Radius = Width; + } + else + { + Radius = 0; + } + + int w = Width.Div(2) + Width.Mod(2); + using (Bitmap bmp = new Bitmap(Width, Height)) + using (Graphics g1 = bmp.Graphics()) + using (LinearGradientBrush lgb = new LinearGradientBrush(new Point(0, 0), + new Point(w, 0), + rectColor, + fillColor)) + { + g1.SetHighQuality(); + g1.FillPath(lgb, path); + g1.SetDefaultQuality(); + g.DrawImage(bmp, new Rectangle(0, 0, w, Height), new Rectangle(0, 0, w, Height), GraphicsUnit.Pixel); + if (Height >= Width * 2 + 4) + for (int i = 0; i < w; i++) + { + + colors[i] = bmp.GetPixel(i, Width + 2); + } + } + + using (Bitmap bmp = new Bitmap(Width, Height)) + using (Graphics g1 = bmp.Graphics()) + using (LinearGradientBrush lgb = new LinearGradientBrush(new Point(w - 1, 0), + new Point(Width, 0), + fillColor, + rectColor)) + { + g1.SetHighQuality(); + g1.FillPath(lgb, path); + g1.SetDefaultQuality(); + + g.DrawImage(bmp, new Rectangle(w, 0, Width - w, Height), new Rectangle(w, 0, Width - w, Height), GraphicsUnit.Pixel); + if (Height >= Width * 2 + 4) + for (int i = w; i < Width; i++) + { + colors[i] = bmp.GetPixel(i, Height - Width - 2); + } + } + + if (Height < Width * 2 + 4) return; + w = Width.Div(2) + Width.Mod(2); + + if (RadiusSides.HasFlag(UICornerRadiusSides.LeftTop) && + !RadiusSides.HasFlag(UICornerRadiusSides.RightTop)) + { + for (int i = 1; i < w; i++) + { + g.DrawArc(new Pen(colors[i], 2), new Rectangle(i, i, Width - i * 2, Width - i * 2), 180, 90); + } + + for (int i = 0; i < w; i++) + { + g.DrawLine(colors[i], w, i, Width, i); + } + + for (int i = w; i < Width; i++) + { + g.DrawLine(colors[i], w + (i - w), i, Width, i); + } + } + + if (!RadiusSides.HasFlag(UICornerRadiusSides.LeftTop) && + RadiusSides.HasFlag(UICornerRadiusSides.RightTop)) + { + for (int i = 1; i < w; i++) + { + g.DrawArc(new Pen(colors[i], 2), new Rectangle(i - 1, i, Width - i * 2, Width - i * 2), 270, 90); + } + + for (int i = 0; i < w; i++) + { + int idx = Width - i; + if (idx >= 0 && idx < Width) + g.DrawLine(colors[idx], 0, i - 1, w, i - 1); + } + + for (int i = w; i < Width; i++) + { + int idx = Width - i; + if (idx >= 0 && idx < Width) + g.DrawLine(colors[idx], 0, i - 1, Width - i, i - 1); + } + } + + if (RadiusSides.HasFlag(UICornerRadiusSides.LeftBottom) && + !RadiusSides.HasFlag(UICornerRadiusSides.RightBottom)) + { + for (int i = 1; i < w; i++) + { + g.DrawArc(new Pen(colors[i], 2), new Rectangle(i, Height - Width + i - 1, Width - i * 2, Width - i * 2), 90, 90); + } + + for (int i = 0; i < w; i++) + { + g.DrawLine(colors[i], w, Height - i - 1, Width, Height - i - 1); + } + + for (int i = w; i < Width; i++) + { + g.DrawLine(colors[i], w + (i - w), Height - i - 1, Width, Height - i - 1); + } + } + + if (!RadiusSides.HasFlag(UICornerRadiusSides.LeftBottom) && + RadiusSides.HasFlag(UICornerRadiusSides.RightBottom)) + { + for (int i = 1; i < w; i++) + { + g.DrawArc(new Pen(colors[i], 2), new Rectangle(i - 1, Height - Width - 1 + i, Width - i * 2, Width - i * 2), 0, 90); + } + + for (int i = 0; i < w; i++) + { + int idx = Width - i; + if (idx >= 0 && idx < Width) + g.DrawLine(colors[idx], 0, Height - i, w, Height - i); + } + + for (int i = w; i < Width; i++) + { + int idx = Width - i; + if (idx >= 0 && idx < Width) + g.DrawLine(colors[idx], 0, Height - i, Width - i, Height - i); + } + } + } + + PaintFlow(g); + } + + private int FlowPos = 0; + + private void PaintFlow(Graphics g) + { + if (IsDesignMode) return; + if (!Active) return; + Color color = Color.FromArgb(150, FlowColor); + if (Direction == UILine.LineDirection.Horizontal) + { + int pos = FlowPos.Mod(FlowSize + FlowInterval); + for (int i = 0; i < int.MaxValue; i++) + { + Rectangle rect = new Rectangle(pos - FlowSize - FlowInterval, 1, FlowSize, Height - 3); + if (rect.Left > Width) break; + bool isShow = rect.Left >= 0 & rect.Right <= Width; + + if (!isShow) + { + if (rect.Left < 0 && rect.Right > 0) + { + rect = new Rectangle(0, rect.Top, rect.Width + rect.Left, rect.Height); + isShow = true; + } + } + + if (!isShow) + { + if (rect.Left < Width && rect.Right > Width) + { + rect = new Rectangle(rect.Left, rect.Top, Width - rect.Left, rect.Height); + isShow = true; + } + } + + if (rect.Width >= rect.Height && isShow) + { + g.FillRoundRectangle(color, rect, Radius - 2); + } + + pos += FlowSize; + pos += flowInterval; + } + + if (FlowDirection == UIFlowDirection.Forward) + FlowPos += FlowSpeed; + if (FlowDirection == UIFlowDirection.Reverse) + FlowPos -= FlowSpeed; + } + + if (Direction == UILine.LineDirection.Vertical) + { + int pos = FlowPos.Mod(FlowSize + FlowInterval); + + int top = 0; + if (RadiusSides.HasFlag(UICornerRadiusSides.LeftTop) && + !RadiusSides.HasFlag(UICornerRadiusSides.RightTop)) top = Width; + if (!RadiusSides.HasFlag(UICornerRadiusSides.LeftTop) && + RadiusSides.HasFlag(UICornerRadiusSides.RightTop)) top = Width; + int bottom = Height - 1; + if (RadiusSides.HasFlag(UICornerRadiusSides.LeftBottom) && + !RadiusSides.HasFlag(UICornerRadiusSides.RightBottom)) bottom = Height - Width; + if (!RadiusSides.HasFlag(UICornerRadiusSides.LeftBottom) && + RadiusSides.HasFlag(UICornerRadiusSides.RightBottom)) bottom = Height - Width; + + for (int i = 0; i < int.MaxValue; i++) + { + Rectangle rect = new Rectangle(1, pos - FlowSize - FlowInterval, Width - 3, FlowSize); + if (rect.Top > Height) break; + bool isShow = rect.Top >= top & rect.Bottom <= bottom; + + if (!isShow) + { + if (rect.Top < top && rect.Bottom > top) + { + rect = new Rectangle(rect.Left, top, rect.Width, rect.Height + rect.Top - top); + isShow = true; + } + } + + if (!isShow) + { + if (rect.Top < bottom && rect.Bottom >= bottom) + { + rect = new Rectangle(rect.Left, rect.Top, rect.Width, bottom - rect.Top); + isShow = true; + } + } + + if (rect.Height >= rect.Width && isShow) + { + g.FillRoundRectangle(color, rect, Radius - 2); + } + + pos += FlowSize; + pos += flowInterval; + } + + if (FlowDirection == UIFlowDirection.Forward) + FlowPos += FlowSpeed; + if (FlowDirection == UIFlowDirection.Reverse) + FlowPos -= FlowSpeed; + } + } + } +} diff --git a/SunnyUI/Controls/UIRichTextBox.cs b/SunnyUI/Controls/UIRichTextBox.cs index ab49159c..ee707c4b 100644 --- a/SunnyUI/Controls/UIRichTextBox.cs +++ b/SunnyUI/Controls/UIRichTextBox.cs @@ -1,4 +1,25 @@ -using System; +/****************************************************************************** + * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。 + * CopyRight (C) 2012-2021 ShenYongHua(沈永华). + * QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com + * + * Blog: https://www.cnblogs.com/yhuse + * Gitee: https://gitee.com/yhuse/SunnyUI + * GitHub: https://github.com/yhuse/SunnyUI + * + * SunnyUI.dll can be used for free under the GPL-3.0 license. + * If you use this code, please keep this note. + * 如果您使用此代码,请保留此说明。 + ****************************************************************************** + * 文件名称: UIRichTextBox.cs + * 文件说明: 富文本输入框 + * 当前版本: V3.0 + * 创建日期: 2020-01-01 + * + * 2020-01-01: V2.2.0 增加文件说明 +******************************************************************************/ + +using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; @@ -244,6 +265,7 @@ namespace Sunny.UI { bar.Maximum = si.ScrollMax; bar.Visible = showScrollBar && (si.ScrollMax > 0 && si.nMax > 0 && si.nPage > 0); + bar.Visible = showScrollBar && ScrollBarInfo.IsVerticalScrollBarVisible(edit); bar.Value = si.nPos; } else diff --git a/SunnyUI/Static/UScrollBarInfo.cs b/SunnyUI/Static/UScrollBarInfo.cs index 172c823f..530dc133 100644 --- a/SunnyUI/Static/UScrollBarInfo.cs +++ b/SunnyUI/Static/UScrollBarInfo.cs @@ -95,5 +95,11 @@ namespace Sunny.UI { User.SendMessage(handle, User.WM_VSCROLL, User.SB_LINEDOWN, 0); } + + public static bool IsVerticalScrollBarVisible(Control ctrl) + { + if (!ctrl.IsHandleCreated) return false; + return (Sunny.UI.Win32.User.GetWindowLong(ctrl.Handle, User.GWL_STYLE) & User.WS_VSCROLL) != 0; + } } } \ No newline at end of file