重构
This commit is contained in:
parent
45d2eed8b9
commit
b68740f828
@ -477,6 +477,8 @@ namespace Sunny.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VBar.ThreadSafeCall(() =>
|
||||||
|
{
|
||||||
if (RowCount > DisplayedRowCount(false))
|
if (RowCount > DisplayedRowCount(false))
|
||||||
{
|
{
|
||||||
VBar.Maximum = RowCount - DisplayedRowCount(false);
|
VBar.Maximum = RowCount - DisplayedRowCount(false);
|
||||||
@ -487,7 +489,10 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
VBar.Visible = false;
|
VBar.Visible = false;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
HBar.ThreadSafeCall(() =>
|
||||||
|
{
|
||||||
if (HorizontalScrollBar.Visible)
|
if (HorizontalScrollBar.Visible)
|
||||||
{
|
{
|
||||||
HBar.Maximum = HorizontalScrollBar.Maximum;
|
HBar.Maximum = HorizontalScrollBar.Maximum;
|
||||||
@ -500,6 +505,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
HBar.Visible = false;
|
HBar.Visible = false;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
SetBarPosition();
|
SetBarPosition();
|
||||||
}
|
}
|
||||||
@ -606,32 +612,44 @@ namespace Sunny.UI
|
|||||||
int barHeight = Math.Max(ScrollBarInfo.HorizontalScrollBarHeight(), ScrollBarHeight);
|
int barHeight = Math.Max(ScrollBarInfo.HorizontalScrollBarHeight(), ScrollBarHeight);
|
||||||
|
|
||||||
if (BorderStyle == BorderStyle.FixedSingle)
|
if (BorderStyle == BorderStyle.FixedSingle)
|
||||||
|
{
|
||||||
|
VBar.ThreadSafeCall(() =>
|
||||||
{
|
{
|
||||||
VBar.Left = Width - barWidth - 2;
|
VBar.Left = Width - barWidth - 2;
|
||||||
VBar.Top = 1;
|
VBar.Top = 1;
|
||||||
VBar.Width = barWidth + 1;
|
VBar.Width = barWidth + 1;
|
||||||
VBar.Height = Height - 2;
|
VBar.Height = Height - 2;
|
||||||
VBar.BringToFront();
|
VBar.BringToFront();
|
||||||
|
});
|
||||||
|
|
||||||
|
HBar.ThreadSafeCall(() =>
|
||||||
|
{
|
||||||
HBar.Left = 1;
|
HBar.Left = 1;
|
||||||
HBar.Height = barHeight + 1;
|
HBar.Height = barHeight + 1;
|
||||||
HBar.Width = Width - (VBar.Visible ? VBar.Width : 0) - 2;
|
HBar.Width = Width - (VBar.Visible ? VBar.Width : 0) - 2;
|
||||||
HBar.Top = Height - HBar.Height - 1;
|
HBar.Top = Height - HBar.Height - 1;
|
||||||
HBar.BringToFront();
|
HBar.BringToFront();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
VBar.ThreadSafeCall(() =>
|
||||||
{
|
{
|
||||||
VBar.Left = Width - barWidth - 1;
|
VBar.Left = Width - barWidth - 1;
|
||||||
VBar.Top = 0;
|
VBar.Top = 0;
|
||||||
VBar.Width = barWidth + 1;
|
VBar.Width = barWidth + 1;
|
||||||
VBar.Height = Height;
|
VBar.Height = Height;
|
||||||
VBar.BringToFront();
|
VBar.BringToFront();
|
||||||
|
});
|
||||||
|
|
||||||
|
HBar.ThreadSafeCall(() =>
|
||||||
|
{
|
||||||
HBar.Left = 0;
|
HBar.Left = 0;
|
||||||
HBar.Height = barHeight + 1;
|
HBar.Height = barHeight + 1;
|
||||||
HBar.Width = Width - (VBar.Visible ? VBar.Width : 0);
|
HBar.Width = Width - (VBar.Visible ? VBar.Width : 0);
|
||||||
HBar.Top = Height - HBar.Height;
|
HBar.Top = Height - HBar.Height;
|
||||||
HBar.BringToFront();
|
HBar.BringToFront();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +61,17 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
waterMarkContainer = new PanelEx();
|
waterMarkContainer = new PanelEx();
|
||||||
waterMarkContainer.Paint += new PaintEventHandler(waterMarkContainer_Paint);
|
waterMarkContainer.Paint += new PaintEventHandler(waterMarkContainer_Paint);
|
||||||
waterMarkContainer.Invalidate();
|
|
||||||
waterMarkContainer.Click += new EventHandler(waterMarkContainer_Click);
|
waterMarkContainer.Click += new EventHandler(waterMarkContainer_Click);
|
||||||
waterMarkContainer.DoubleClick += WaterMarkContainer_DoubleClick;
|
waterMarkContainer.DoubleClick += WaterMarkContainer_DoubleClick;
|
||||||
|
this.ThreadSafeCall(() =>
|
||||||
|
{
|
||||||
this.Controls.Add(waterMarkContainer);
|
this.Controls.Add(waterMarkContainer);
|
||||||
|
});
|
||||||
|
|
||||||
|
waterMarkContainer.ThreadSafeCall(() =>
|
||||||
|
{
|
||||||
|
waterMarkContainer.Invalidate();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,8 +99,12 @@ namespace Sunny.UI
|
|||||||
private void RemoveWaterMark()
|
private void RemoveWaterMark()
|
||||||
{
|
{
|
||||||
if (waterMarkContainer != null)
|
if (waterMarkContainer != null)
|
||||||
|
{
|
||||||
|
this.ThreadSafeCall(() =>
|
||||||
{
|
{
|
||||||
Controls.Remove(waterMarkContainer);
|
Controls.Remove(waterMarkContainer);
|
||||||
|
});
|
||||||
|
|
||||||
waterMarkContainer = null;
|
waterMarkContainer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
if (IsDisposed) return;
|
if (IsDisposed) return;
|
||||||
TextChanged?.Invoke(this, e);
|
TextChanged?.Invoke(this, e);
|
||||||
SetScrollInfo();
|
if (Multiline) SetScrollInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -722,6 +722,8 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
var si = ScrollBarInfo.GetInfo(edit.Handle);
|
var si = ScrollBarInfo.GetInfo(edit.Handle);
|
||||||
|
bar.ThreadSafeCall(() =>
|
||||||
|
{
|
||||||
if (si.ScrollMax > 0)
|
if (si.ScrollMax > 0)
|
||||||
{
|
{
|
||||||
bar.Maximum = si.ScrollMax;
|
bar.Maximum = si.ScrollMax;
|
||||||
@ -731,6 +733,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
bar.Maximum = si.ScrollMax;
|
bar.Maximum = si.ScrollMax;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnRadiusChanged(int value)
|
protected override void OnRadiusChanged(int value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user