* UIComboDataGridView: 有过滤输入框时默认Focus
This commit is contained in:
parent
f53b3a56a0
commit
fe2e06f506
Binary file not shown.
@ -57,6 +57,26 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public static Size Size(this SizeF size)
|
||||
{
|
||||
return new Size(size.Width.RoundEx(), size.Height.RoundEx());
|
||||
}
|
||||
|
||||
public static Point Point(this PointF point)
|
||||
{
|
||||
return new Point(point.X.RoundEx(), point.Y.RoundEx());
|
||||
}
|
||||
|
||||
public static Size Add(this Size size, int width, int height)
|
||||
{
|
||||
return new Size(size.Width + width, size.Height + height);
|
||||
}
|
||||
|
||||
public static SizeF Add(this SizeF size, float width, float height)
|
||||
{
|
||||
return new SizeF(size.Width + width, size.Height + height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点是否在区域内
|
||||
/// </summary>
|
||||
@ -126,7 +146,7 @@ namespace Sunny.UI
|
||||
/// 提供一个Graphics,常用于需要计算文字大小时
|
||||
/// </summary>
|
||||
/// <returns>大小</returns>
|
||||
public static Graphics Graphics()
|
||||
private static Graphics Graphics()
|
||||
{
|
||||
if (TempGraphics == null)
|
||||
{
|
||||
|
@ -578,13 +578,13 @@ namespace Sunny.UI
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
DoValueChanged(this, SelectedColor);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void m_colorSample_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
|
@ -44,7 +44,7 @@ namespace Sunny.UI
|
||||
|
||||
private void ListBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -74,7 +74,7 @@ namespace Sunny.UI
|
||||
{
|
||||
if (e.KeyCode == System.Windows.Forms.Keys.Enter || e.KeyCode == System.Windows.Forms.Keys.Space)
|
||||
{
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -262,12 +262,12 @@ namespace Sunny.UI
|
||||
DoValueChanged(this, dataGridView.SelectedIndex);
|
||||
}
|
||||
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
public bool ShowFilter
|
||||
@ -317,5 +317,18 @@ namespace Sunny.UI
|
||||
btnSearch.PerformClick();
|
||||
DoValueChanged(this, null);
|
||||
}
|
||||
|
||||
public override void InitShow()
|
||||
{
|
||||
if (ShowFilter)
|
||||
{
|
||||
edtFilter.Focus();
|
||||
edtFilter.SelectAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
btnOK.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ namespace Sunny.UI
|
||||
if (e.Node.Nodes.Count == 0 || CanSelectRootNode)
|
||||
{
|
||||
DoValueChanged(this, e.Node);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,13 +159,13 @@ namespace Sunny.UI
|
||||
|
||||
private void btnCancel_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
DoValueChanged(this, treeView.Nodes);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ namespace Sunny.UI
|
||||
{
|
||||
date = new DateTime(Year, Month, 1);
|
||||
DoValueChanged(this, Date);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -667,7 +667,7 @@ namespace Sunny.UI
|
||||
{
|
||||
date = new DateTime(Year, 1, 1);
|
||||
DoValueChanged(this, Date);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -771,7 +771,7 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
DoValueChanged(this, Date);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
public Color PrimaryColor { get; set; } = UIColor.Blue;
|
||||
|
@ -1089,14 +1089,14 @@ namespace Sunny.UI
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
DateTime time = new DateTime(Date.Year, Date.Month, Date.Day, Hour, Minute, Second);
|
||||
DoValueChanged(this, time);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void hc_DoubleClick(object sender, EventArgs e)
|
||||
|
@ -301,6 +301,7 @@ namespace Sunny.UI
|
||||
protected override void OnOpened(EventArgs e)
|
||||
{
|
||||
Item.Focus();
|
||||
Item.InitShow();
|
||||
base.OnOpened(e);
|
||||
}
|
||||
|
||||
|
@ -88,19 +88,19 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 关闭弹出窗口
|
||||
/// </summary>
|
||||
protected void CloseParent()
|
||||
public void Close()
|
||||
{
|
||||
UIDropDown parent = (UIDropDown)Parent;
|
||||
parent?.Close();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
CloseParent();
|
||||
}
|
||||
|
||||
public virtual void SetStyle(UIBaseStyle style)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void InitShow()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -587,12 +587,12 @@ namespace Sunny.UI
|
||||
{
|
||||
time = new DateTime(DateTime.MinValue.Year, DateTime.MinValue.Month, DateTime.MinValue.Day, Hour, Minute, Second);
|
||||
DoValueChanged(this, time);
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseParent();
|
||||
Close();
|
||||
}
|
||||
|
||||
public override void SetStyle(UIBaseStyle style)
|
||||
|
@ -174,32 +174,27 @@ namespace Sunny.UI
|
||||
}
|
||||
else
|
||||
{
|
||||
var bmp = new Bitmap(e.ToolTipSize.Width, e.ToolTipSize.Height);
|
||||
var g = Graphics.FromImage(bmp);
|
||||
int symbolWidth = tooltip.Symbol > 0 ? tooltip.SymbolSize : 0;
|
||||
|
||||
|
||||
SizeF titleSize = new SizeF(0, 0);
|
||||
if (tooltip.Title.IsValid())
|
||||
{
|
||||
titleSize = g.MeasureString(tooltip.Title, TempTitleFont);
|
||||
titleSize = GDI.MeasureString(tooltip.Title, TempTitleFont);
|
||||
}
|
||||
|
||||
SizeF textSize = g.MeasureString(tooltip.ToolTipText, TempTitleFont);
|
||||
SizeF textSize = GDI.MeasureString(tooltip.ToolTipText, TempFont);
|
||||
int allWidth = (int)Math.Max(textSize.Width, titleSize.Width) + 10;
|
||||
if (symbolWidth > 0) allWidth = allWidth + symbolWidth + 5;
|
||||
int allHeight = titleSize.Height > 0 ?
|
||||
(int)titleSize.Height + (int)textSize.Height + 15 :
|
||||
(int)textSize.Height + 10;
|
||||
e.ToolTipSize = new Size(allWidth, allHeight);
|
||||
bmp.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SizeF sf = GDI.MeasureString(GetToolTip(e.AssociatedControl), TempTitleFont);
|
||||
e.ToolTipSize = new Size((int)sf.Width + 10, (int)sf.Height + 10);
|
||||
SizeF sf = GDI.MeasureString(GetToolTip(e.AssociatedControl), TempFont);
|
||||
e.ToolTipSize = sf.Size().Add(10, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,13 +264,13 @@ namespace Sunny.UI
|
||||
e.Bounds.Width - 5, 5 + titleSize.Height + 3);
|
||||
}
|
||||
|
||||
e.Graphics.DrawString(e.ToolTipText, TempTitleFont, ForeColor,
|
||||
e.Graphics.DrawString(e.ToolTipText, TempFont, ForeColor,
|
||||
tooltip.Symbol > 0 ? tooltip.SymbolSize + 5 : 5,
|
||||
titleSize.Height > 0 ? 10 + titleSize.Height : 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawString(e.ToolTipText, TempTitleFont, ForeColor, 5, 5);
|
||||
e.Graphics.DrawString(e.ToolTipText, TempFont, ForeColor, 5, 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user