* UIFlowLayoutPanel: 删除点击的Focus事件
This commit is contained in:
parent
929410fec7
commit
0cbd2f7083
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -55,7 +55,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiFlowLayoutPanel1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiFlowLayoutPanel1.Name = "uiFlowLayoutPanel1";
|
||||
this.uiFlowLayoutPanel1.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.uiFlowLayoutPanel1.Size = new System.Drawing.Size(334, 390);
|
||||
this.uiFlowLayoutPanel1.Size = new System.Drawing.Size(354, 390);
|
||||
this.uiFlowLayoutPanel1.TabIndex = 10;
|
||||
this.uiFlowLayoutPanel1.Text = "`";
|
||||
this.uiFlowLayoutPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
@ -64,7 +64,7 @@ namespace Sunny.UI.Demo
|
||||
//
|
||||
this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiButton2.Location = new System.Drawing.Point(264, 462);
|
||||
this.uiButton2.Location = new System.Drawing.Point(284, 462);
|
||||
this.uiButton2.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiButton2.Name = "uiButton2";
|
||||
this.uiButton2.Size = new System.Drawing.Size(100, 35);
|
||||
@ -77,7 +77,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiButton3.Enabled = false;
|
||||
this.uiButton3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiButton3.Location = new System.Drawing.Point(147, 462);
|
||||
this.uiButton3.Location = new System.Drawing.Point(157, 462);
|
||||
this.uiButton3.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiButton3.Name = "uiButton3";
|
||||
this.uiButton3.Size = new System.Drawing.Size(100, 35);
|
||||
|
@ -13,7 +13,7 @@
|
||||
uiFlowLayoutPanel1.Clear();
|
||||
index = 0;
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
uiButton1.PerformClick();
|
||||
}
|
||||
@ -23,10 +23,9 @@
|
||||
UIButton btn;
|
||||
private void uiButton1_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
btn = new UIButton
|
||||
{
|
||||
Text = "Button" + index++.ToString("D2")
|
||||
};
|
||||
btn = new UIButton();
|
||||
btn.Text = "Button" + index++.ToString("D2");
|
||||
//btn.Click += Btn_Click;
|
||||
|
||||
//建议用封装的方法Add
|
||||
uiFlowLayoutPanel1.Add(btn);
|
||||
@ -36,6 +35,12 @@
|
||||
uiButton3.Enabled = true;
|
||||
}
|
||||
|
||||
private void Btn_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
var button = (UIButton)sender;
|
||||
ShowInfoTip(button.Text);
|
||||
}
|
||||
|
||||
private void uiButton2_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
//清除用Clear方法
|
||||
|
@ -58,6 +58,23 @@ namespace Sunny.UI
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
public new void Focus()
|
||||
{
|
||||
base.Focus();
|
||||
Panel.Focus();
|
||||
}
|
||||
|
||||
public override bool Focused
|
||||
{
|
||||
get => Panel.Focused;
|
||||
}
|
||||
|
||||
protected override void OnEnter(EventArgs e)
|
||||
{
|
||||
base.OnEnter(e);
|
||||
Panel.Focus();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
@ -259,12 +276,12 @@ namespace Sunny.UI
|
||||
|
||||
private void Panel_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
Panel.Focus();
|
||||
//Panel.Focus();
|
||||
}
|
||||
|
||||
private void Panel_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
Panel.Focus();
|
||||
//Panel.Focus();
|
||||
}
|
||||
|
||||
protected override void OnGotFocus(EventArgs e)
|
||||
|
@ -121,7 +121,7 @@ namespace Sunny.UI
|
||||
get => valveColor;
|
||||
set
|
||||
{
|
||||
valveColor = value;
|
||||
valveColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user