* UICombobox:增加TextChange事件

* 取消部分ResizeRedraw
This commit is contained in:
Sunny 2020-09-25 20:17:19 +08:00
parent 1fac28592f
commit f30ffa9f19
16 changed files with 59 additions and 31 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -105,6 +105,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1024, 720);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(1024, 720);
this.Name = "FMain";
this.Padding = new System.Windows.Forms.Padding(2, 35, 2, 2);
this.ShowDragStretch = true;

View File

@ -81,6 +81,7 @@ namespace Sunny.UI
public new event KeyPressEventHandler KeyPress;
[Browsable(true)]
public new event EventHandler TextChanged;
private void EditOnKeyPress(object sender, KeyPressEventArgs e)

View File

@ -92,7 +92,7 @@ namespace Sunny.UI
InitializeComponent();
AutoSize = false;
DoubleBuffered = true;
ResizeRedraw = true;
//ResizeRedraw = true;
ToolStripControlHost _host = new ToolStripControlHost(item);
Padding = Margin = _host.Padding = _host.Margin = Padding.Empty;
item.MinimumSize = item.Size;

View File

@ -115,7 +115,6 @@ namespace Sunny.UI
/// <param name="value">数值</param>
protected override void InitValue(object value)
{
Console.WriteLine(value.ToString());
UICornerRadiusSides sides = (UICornerRadiusSides)value;
ResetCheckBoxState();
if ((sides & UICornerRadiusSides.All) == UICornerRadiusSides.All)

View File

@ -39,7 +39,12 @@ namespace Sunny.UI
/// </summary>
public UIControl()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
base.DoubleBuffered = true;
UpdateStyles();

View File

@ -41,11 +41,10 @@ namespace Sunny.UI
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.ResizeRedraw, true);
DoubleBuffered = true;
UpdateStyles();
Font = UIFontColor.Font;
@ -57,6 +56,12 @@ namespace Sunny.UI
Version = UIGlobal.Version;
}
protected override void OnFontChanged(EventArgs e)
{
base.OnFontChanged(e);
if (NavBarMenu != null) NavBarMenu.Font = Font;
}
[DefaultValue(null)]
[Description("关联的TabControl"), Category("SunnyUI")]
public UITabControl TabControl { get; set; }

View File

@ -44,9 +44,9 @@ namespace Sunny.UI
public UIPanel()
{
InitializeComponent();
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.UserPaint, true);
@ -55,6 +55,7 @@ namespace Sunny.UI
UpdateStyles();
Version = UIGlobal.Version;
AutoScaleMode = AutoScaleMode.None;
base.Font = UIFontColor.Font;
base.MinimumSize = new System.Drawing.Size(1, 1);
}

View File

@ -46,20 +46,13 @@ namespace Sunny.UI
edit.ScrollBars = RichTextBoxScrollBars.Vertical;
}
private bool showScrollBar = true;
protected override void OnFontChanged(EventArgs e)
{
base.OnFontChanged(e);
if (edit != null) edit.Font = Font;
}
// [DefaultValue(true)]
// public bool ShowScrollBar
// {
// get => showScrollBar;
// set
// {
// showScrollBar = value;
// bar.Visible = value;
// edit.ScrollBars = value ? RichTextBoxScrollBars.Vertical : RichTextBoxScrollBars.None;
// SetScrollInfo();
// }
// }
private bool showScrollBar = true;
[DefaultValue(false)]
[Description("是否只读"), Category("SunnyUI")]

View File

@ -34,6 +34,12 @@ namespace Sunny.UI
{
public delegate void OnValueChanged(object sender, bool value);
public enum UISwitchShape
{
Round,
Square
}
public UISwitch()
{
Height = 29;
@ -45,6 +51,20 @@ namespace Sunny.UI
fillColor = Color.White;
}
public UISwitchShape switchShape = UISwitchShape.Round;
[Description("开关形状"), Category("SunnyUI")]
[DefaultValue(UISwitchShape.Round)]
public UISwitchShape SwitchShape
{
get => switchShape;
set
{
switchShape = value;
Invalidate();
}
}
public event OnValueChanged ValueChanged;
/// <summary>
@ -169,7 +189,7 @@ namespace Sunny.UI
protected override void OnPaintFill(Graphics g, GraphicsPath path)
{
Width = (int)(Height * 2.6);
//Width = (int)(Height * 2.6);
Rectangle rect = new Rectangle(0, 0, Width - 1, Height - 1);
g.FillRoundRectangle(Active ? ActiveColor : InActiveColor, rect, rect.Height);

View File

@ -39,7 +39,7 @@ namespace Sunny.UI
public UITabControl()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
ItemSize = new Size(150, 40);
DrawMode = TabDrawMode.OwnerDrawFixed;

View File

@ -31,7 +31,7 @@ namespace Sunny.UI
{
public UITabControlMenu()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
ItemSize = new Size(40, 200);
DrawMode = TabDrawMode.OwnerDrawFixed;

View File

@ -55,14 +55,12 @@ namespace Sunny.UI
ControlStyles.DoubleBuffer |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint |
//ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor, true);
UpdateStyles();
Version = UIGlobal.Version;
FormBorderStyle = FormBorderStyle.None;
m_aeroEnabled = false;
base.MaximumSize = ShowFullScreen ? Screen.PrimaryScreen.Bounds.Size : Screen.PrimaryScreen.WorkingArea.Size;
}
//不显示FormBorderStyle属性
@ -72,11 +70,7 @@ namespace Sunny.UI
public new FormBorderStyle FormBorderStyle
{
get { return base.FormBorderStyle; }
set
{
base.FormBorderStyle = FormBorderStyle.None;
Console.WriteLine(value);
}
set { base.FormBorderStyle = FormBorderStyle.None; }
}
public void Render()
@ -281,11 +275,21 @@ namespace Sunny.UI
{
}
private bool showFullScreen;
/// <summary>
/// 是否以全屏模式进入最大化
/// </summary>
[Description("是否以全屏模式进入最大化"), Category("WindowStyle"), DefaultValue(false)]
public bool ShowFullScreen { get; set; }
public bool ShowFullScreen
{
get => showFullScreen;
set
{
showFullScreen = value;
base.MaximumSize = ShowFullScreen ? Screen.PrimaryScreen.Bounds.Size : Screen.PrimaryScreen.WorkingArea.Size;
}
}
/// <summary>
/// 标题栏高度
@ -1019,7 +1023,6 @@ namespace Sunny.UI
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
CalcSystemBoxPos();
SetRadius();
isShow = true;