* UIFlowLayoutPanel:修改了一处因为其加入控件大小发生变化而引起的滚动条出错。
This commit is contained in:
parent
e7ca29925e
commit
fca422df1c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -18,7 +18,7 @@
|
||||
private void timer1_Tick(object sender, System.EventArgs e)
|
||||
{
|
||||
value++;
|
||||
uiTrackBar1.Value = value;
|
||||
uiTrackBar2.Value = uiTrackBar1.Value = value;
|
||||
uiProcessBar2.Value = uiProcessBar1.Value = value;
|
||||
uiRoundProcess2.Value = uiRoundProcess1.Value = value;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace Sunny.UI
|
||||
private UIVerScrollBarEx VBar;
|
||||
private UIHorScrollBarEx HBar;
|
||||
private FlowLayoutPanel flowLayoutPanel;
|
||||
private readonly Timer timer = new Timer();
|
||||
|
||||
public UIFlowLayoutPanel()
|
||||
{
|
||||
@ -46,11 +47,36 @@ namespace Sunny.UI
|
||||
Panel.MouseWheel += Panel_MouseWheel;
|
||||
Panel.MouseEnter += Panel_MouseEnter;
|
||||
Panel.MouseClick += Panel_MouseClick;
|
||||
Panel.ClientSizeChanged += Panel_ClientSizeChanged;
|
||||
|
||||
VBar.ValueChanged += VBar_ValueChanged;
|
||||
HBar.ValueChanged += HBar_ValueChanged;
|
||||
|
||||
SizeChanged += Panel_SizeChanged;
|
||||
timer.Interval = 100;
|
||||
timer.Tick += Timer_Tick;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
~UIFlowLayoutPanel()
|
||||
{
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (VBar.Maximum != Panel.VerticalScroll.Maximum ||
|
||||
VBar.Visible != Panel.VerticalScroll.Visible ||
|
||||
HBar.Maximum != Panel.HorizontalScroll.Maximum ||
|
||||
HBar.Visible != Panel.HorizontalScroll.Visible)
|
||||
{
|
||||
SetScrollInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private void Panel_ClientSizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
SetScrollInfo();
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
@ -149,7 +175,8 @@ namespace Sunny.UI
|
||||
|
||||
private void VBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Panel.VerticalScroll.Value = VBar.Value;
|
||||
if (VBar.Value.InRange(0, Panel.VerticalScroll.Maximum))
|
||||
Panel.VerticalScroll.Value = VBar.Value;
|
||||
}
|
||||
|
||||
private void HBar_ValueChanged(object sender, EventArgs e)
|
||||
@ -177,7 +204,7 @@ namespace Sunny.UI
|
||||
SetScrollInfo();
|
||||
}
|
||||
|
||||
private void SetScrollInfo()
|
||||
public void SetScrollInfo()
|
||||
{
|
||||
VBar.Visible = Panel.VerticalScroll.Visible;
|
||||
VBar.Maximum = Panel.VerticalScroll.Maximum;
|
||||
|
Loading…
x
Reference in New Issue
Block a user