* UITextBox:增加Click事件,Cursor可设置

* UIRichTextBox:增加ReadOnly属性
This commit is contained in:
Sunny 2020-07-20 21:29:33 +08:00
parent ac4e035573
commit 667ab5e688
8 changed files with 40 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -92,6 +92,7 @@
this.uiTextBox1.Size = new System.Drawing.Size(221, 29);
this.uiTextBox1.TabIndex = 3;
this.uiTextBox1.Watermark = "水印文字";
this.uiTextBox1.Click += new System.EventHandler(this.uiTextBox1_Click);
//
// uiLabel1
//

View File

@ -6,5 +6,10 @@
{
InitializeComponent();
}
private void uiTextBox1_Click(object sender, System.EventArgs e)
{
}
}
}

View File

@ -61,6 +61,13 @@ namespace Sunny.UI
// }
// }
[DefaultValue(false)]
public bool ReadOnly
{
get => edit.ReadOnly;
set => edit.ReadOnly = value;
}
private void Edit_SelectionChanged(object sender, EventArgs e)
{
SelectionChanged?.Invoke(sender, e);

View File

@ -55,6 +55,8 @@ namespace Sunny.UI
edit.KeyUp += EditOnKeyUp;
edit.KeyPress += EditOnKeyPress;
edit.MouseEnter += Edit_MouseEnter;
edit.Click += Edit_Click;
edit.DoubleClick += Edit_DoubleClick;
edit.Invalidate();
Controls.Add(edit);
@ -70,16 +72,40 @@ namespace Sunny.UI
bar.MouseEnter += Bar_MouseEnter;
SizeChange();
editCursor = Cursor;
}
private void Edit_DoubleClick(object sender, EventArgs e)
{
DoubleClick?.Invoke(this,e);
}
public new event EventHandler DoubleClick;
public new event EventHandler Click;
private void Edit_Click(object sender, EventArgs e)
{
Click?.Invoke(this,e);
}
protected override void OnCursorChanged(EventArgs e)
{
base.OnCursorChanged(e);
edit.Cursor = Cursor;
}
private Cursor editCursor;
private void Bar_MouseEnter(object sender, EventArgs e)
{
editCursor = Cursor;
Cursor = Cursors.Default;
}
private void Edit_MouseEnter(object sender, EventArgs e)
{
Cursor = Cursors.IBeam;
Cursor = editCursor;
}
private void OnMouseWheel(object sender, MouseEventArgs e)