You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

109 lines
2.3 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace PDAForm.PDAControl
{
public partial class ctrSelect : UserControl
{
#region 属性
public override string Text
{
get
{
return this.txtSelect.Text.Trim();
}
set
{
this.txtSelect.Text = value;
}
}
public bool ReadOnly
{
get
{
return this.txtSelect.ReadOnly;
}
set
{
this.txtSelect.ReadOnly = value;
}
}
#endregion
#region 方法
new public void Focus()
{
this.txtSelect.Focus();
}
public void SelectAll()
{
this.txtSelect.SelectAll();
}
#endregion
#region 界面调整
public ctrSelect()
{
InitializeComponent();
ControlAutoSize();
}
private void ctrSelect_Resize(object sender, EventArgs e)
{
ControlAutoSize();
}
private void ControlAutoSize()
{
this.btnSelect.Width = 36;
this.btnSelect.Height = 23;
this.txtSelect.Location = new Point(0, 0);
this.Height = this.txtSelect.Height;
this.btnSelect.Height = this.Height;
this.txtSelect.Width = this.Width;
this.btnSelect.Left = this.txtSelect.Width - this.btnSelect.Width - 1;
this.btnSelect.Top = this.txtSelect.Top-1;
this.txtSelect.SendToBack();
}
#endregion
#region 事件
//点击事件
public event EventHandler OnSelectClick;
private void btnSelect_Click(object sender, EventArgs e)
{
if (OnSelectClick != null)
{
OnSelectClick(this, e);
}
}
private void txtSelect_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
btnSelect_Click(this, e);
}
}
#endregion
}
}