* UIListBox: 增加两个方法

This commit is contained in:
Sunny 2021-08-01 10:57:52 +08:00
parent d7efde59c8
commit 4a108f1db5
10 changed files with 33 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -23,8 +23,11 @@
UIButton btn;
private void uiButton1_Click(object sender, System.EventArgs e)
{
btn = new UIButton();
btn.Text = "Button" + index++.ToString("D2");
btn = new UIButton
{
Text = "Button" + index++.ToString("D2")
};
//可以用原生方法Controls.Add
uiFlowLayoutPanel1.Controls.Add(btn);
//或者封装的方法Add

View File

@ -166,11 +166,14 @@ namespace Sunny.UI.Demo
private void uiSymbolButton3_Click(object sender, EventArgs e)
{
UILoginForm frm = new UILoginForm();
frm.ShowInTaskbar = true;
frm.Text = "Login";
frm.Title = "SunnyUI.Net Login Form";
frm.SubText = Version;
UILoginForm frm = new UILoginForm
{
ShowInTaskbar = true,
Text = "Login",
Title = "SunnyUI.Net Login Form",
SubText = Version
};
frm.OnLogin += Frm_OnLogin;
frm.LoginImage = UILoginForm.UILoginImage.Login2;
frm.ShowDialog();

View File

@ -67,6 +67,16 @@ namespace Sunny.UI
listbox.MouseMove += Listbox_MouseMove;
}
public int IndexFromPoint(Point p)
{
return listbox.IndexFromPoint(p);
}
public int IndexFromPoint(int x, int y)
{
return listbox.IndexFromPoint(x, y);
}
protected override void AfterSetFillColor(Color color)
{
base.AfterSetFillColor(color);

View File

@ -77,6 +77,16 @@ namespace Sunny.UI
[Browsable(false)]
public ListBox ListBox => listbox;
public int IndexFromPoint(Point p)
{
return listbox.IndexFromPoint(p);
}
public int IndexFromPoint(int x, int y)
{
return listbox.IndexFromPoint(x, y);
}
[DefaultValue(StringAlignment.Near)]
[Description("列表项高度"), Category("SunnyUI")]
public new StringAlignment TextAlignment
@ -100,7 +110,6 @@ namespace Sunny.UI
get => listbox.SelectedIndices;
}
protected override void OnContextMenuStripChanged(EventArgs e)
{
base.OnContextMenuStripChanged(e);