Browse Source

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

* UIRichTextBox:增加ReadOnly属性
pull/95/head
Sunny 5 years ago
parent
commit
667ab5e688
  1. BIN
      Bin/SunnyUI.dll
  2. BIN
      Bin/SunnyUI.pdb
  3. BIN
      SunnyUI.Demo/Bin/SunnyUI.Demo.exe
  4. BIN
      SunnyUI.Demo/Bin/SunnyUI.dll
  5. 1
      SunnyUI.Demo/Controls/FTextBox.Designer.cs
  6. 5
      SunnyUI.Demo/Controls/FTextBox.cs
  7. 7
      SunnyUI/Controls/UIRichTextBox.cs
  8. 28
      SunnyUI/Controls/UITextBox.cs

BIN
Bin/SunnyUI.dll

BIN
Bin/SunnyUI.pdb

BIN
SunnyUI.Demo/Bin/SunnyUI.Demo.exe

BIN
SunnyUI.Demo/Bin/SunnyUI.dll

1
SunnyUI.Demo/Controls/FTextBox.Designer.cs

@ -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
//

5
SunnyUI.Demo/Controls/FTextBox.cs

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

7
SunnyUI/Controls/UIRichTextBox.cs

@ -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);

28
SunnyUI/Controls/UITextBox.cs

@ -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)

Loading…
Cancel
Save