+ UIWaitingBar:新增等待滚动条控件
This commit is contained in:
parent
e1e5c3a31d
commit
ac4e035573
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
35
SunnyUI.Demo/Controls/FOther.Designer.cs
generated
35
SunnyUI.Demo/Controls/FOther.Designer.cs
generated
@ -49,11 +49,15 @@
|
||||
this.uiLine6 = new Sunny.UI.UILine();
|
||||
this.uiScrollingText1 = new Sunny.UI.UIScrollingText();
|
||||
this.uiScrollingText2 = new Sunny.UI.UIScrollingText();
|
||||
this.uiWaitingBar1 = new Sunny.UI.UIWaitingBar();
|
||||
this.uiLine1 = new Sunny.UI.UILine();
|
||||
this.PagePanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PagePanel
|
||||
//
|
||||
this.PagePanel.Controls.Add(this.uiLine1);
|
||||
this.PagePanel.Controls.Add(this.uiWaitingBar1);
|
||||
this.PagePanel.Controls.Add(this.uiScrollingText2);
|
||||
this.PagePanel.Controls.Add(this.uiScrollingText1);
|
||||
this.PagePanel.Controls.Add(this.uiLine6);
|
||||
@ -145,7 +149,7 @@
|
||||
// uiProgressIndicator1
|
||||
//
|
||||
this.uiProgressIndicator1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiProgressIndicator1.Location = new System.Drawing.Point(30, 209);
|
||||
this.uiProgressIndicator1.Location = new System.Drawing.Point(30, 298);
|
||||
this.uiProgressIndicator1.Name = "uiProgressIndicator1";
|
||||
this.uiProgressIndicator1.Size = new System.Drawing.Size(119, 132);
|
||||
this.uiProgressIndicator1.TabIndex = 26;
|
||||
@ -154,7 +158,7 @@
|
||||
// uiLine4
|
||||
//
|
||||
this.uiLine4.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine4.Location = new System.Drawing.Point(30, 182);
|
||||
this.uiLine4.Location = new System.Drawing.Point(30, 271);
|
||||
this.uiLine4.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine4.Name = "uiLine4";
|
||||
this.uiLine4.Size = new System.Drawing.Size(319, 20);
|
||||
@ -264,7 +268,7 @@
|
||||
this.uiScrollingText1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiScrollingText1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiScrollingText1.ForeColor = System.Drawing.Color.Red;
|
||||
this.uiScrollingText1.Location = new System.Drawing.Point(381, 208);
|
||||
this.uiScrollingText1.Location = new System.Drawing.Point(381, 215);
|
||||
this.uiScrollingText1.Name = "uiScrollingText1";
|
||||
this.uiScrollingText1.ScrollingType = Sunny.UI.UIScrollingText.UIScrollingType.LeftToRight;
|
||||
this.uiScrollingText1.Size = new System.Drawing.Size(319, 35);
|
||||
@ -278,12 +282,33 @@
|
||||
this.uiScrollingText2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiScrollingText2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiScrollingText2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
||||
this.uiScrollingText2.Location = new System.Drawing.Point(381, 249);
|
||||
this.uiScrollingText2.Location = new System.Drawing.Point(381, 256);
|
||||
this.uiScrollingText2.Name = "uiScrollingText2";
|
||||
this.uiScrollingText2.Size = new System.Drawing.Size(319, 35);
|
||||
this.uiScrollingText2.TabIndex = 49;
|
||||
this.uiScrollingText2.Text = "赠人玫瑰手有余香";
|
||||
//
|
||||
// uiWaitingBar1
|
||||
//
|
||||
this.uiWaitingBar1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiWaitingBar1.Location = new System.Drawing.Point(30, 215);
|
||||
this.uiWaitingBar1.MinimumSize = new System.Drawing.Size(70, 23);
|
||||
this.uiWaitingBar1.Name = "uiWaitingBar1";
|
||||
this.uiWaitingBar1.Size = new System.Drawing.Size(319, 29);
|
||||
this.uiWaitingBar1.TabIndex = 50;
|
||||
this.uiWaitingBar1.Text = "uiWaitingBar1";
|
||||
//
|
||||
// uiLine1
|
||||
//
|
||||
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine1.Location = new System.Drawing.Point(30, 182);
|
||||
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine1.Name = "uiLine1";
|
||||
this.uiLine1.Size = new System.Drawing.Size(319, 20);
|
||||
this.uiLine1.TabIndex = 51;
|
||||
this.uiLine1.Text = "UIWaitingBar";
|
||||
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// FOther
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
@ -318,5 +343,7 @@
|
||||
private UILine uiLine6;
|
||||
private UIScrollingText uiScrollingText1;
|
||||
private UIScrollingText uiScrollingText2;
|
||||
private UIWaitingBar uiWaitingBar1;
|
||||
private UILine uiLine1;
|
||||
}
|
||||
}
|
@ -296,8 +296,12 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
path.Dispose();
|
||||
|
||||
PaintOther?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public event PaintEventHandler PaintOther;
|
||||
|
||||
/// <summary>
|
||||
/// 获取边框颜色
|
||||
/// </summary>
|
||||
|
104
SunnyUI/Controls/UIWaitingBar.cs
Normal file
104
SunnyUI/Controls/UIWaitingBar.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
[ToolboxItem(true)]
|
||||
public sealed class UIWaitingBar : UIControl
|
||||
{
|
||||
private System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
|
||||
|
||||
public UIWaitingBar()
|
||||
{
|
||||
MinimumSize = new Size(70, 23);
|
||||
Size = new Size(300, 29);
|
||||
ShowText = false;
|
||||
|
||||
PaintOther += UIWaitingBar_PaintOther;
|
||||
|
||||
fillColor = UIColor.LightBlue;
|
||||
foreColor = UIColor.Blue;
|
||||
timer.Interval = 200;
|
||||
timer.Tick += Timer_Tick;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void UIWaitingBar_PaintOther(object sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.FillRoundRectangle(rectColor, (int)dz + 1, 1, sliderWidth, Height - 3, Radius);
|
||||
}
|
||||
|
||||
//d是度数,不是弧度
|
||||
private double d;
|
||||
|
||||
private double dz;
|
||||
|
||||
private int blockCount = 20;
|
||||
|
||||
[DefaultValue(20)]
|
||||
public int BlockCount
|
||||
{
|
||||
get => blockCount;
|
||||
set => blockCount = Math.Max(10, value);
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
//移动距离要减去滑块本身的宽度
|
||||
double dMoveDistance = Width - SliderWidth - 3;
|
||||
//需要变化的次数
|
||||
double dStep = dMoveDistance / blockCount;
|
||||
//每次变化所增加的度数
|
||||
double dPer = 180.0 / dStep;
|
||||
|
||||
d += dPer;
|
||||
if (d > 360)
|
||||
{
|
||||
//一个周期是360度
|
||||
d = 0;
|
||||
}
|
||||
|
||||
//通过公式:弧度=度*π/180,将度数i转为Math.Sin()所需要的弧度数
|
||||
dz = dMoveDistance * (1 + Math.Sin((d - 90) * Math.PI / 180)) / 2;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
[DefaultValue(200)]
|
||||
public int Interval
|
||||
{
|
||||
get => timer.Interval;
|
||||
set
|
||||
{
|
||||
timer.Stop();
|
||||
timer.Interval = Math.Max(50, value);
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private int sliderWidth = 60;
|
||||
|
||||
[DefaultValue(60)]
|
||||
public int SliderWidth
|
||||
{
|
||||
get => sliderWidth;
|
||||
set
|
||||
{
|
||||
sliderWidth = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||
{
|
||||
base.SetStyleColor(uiColor);
|
||||
if (uiColor.IsCustom()) return;
|
||||
|
||||
fillColor = uiColor.ProcessBarFillColor;
|
||||
foreColor = uiColor.ProcessBarForeColor;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
@ -129,6 +129,9 @@
|
||||
<Compile Include="Controls\UITransparentPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\UIWaitingBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UILoginForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
Loading…
x
Reference in New Issue
Block a user