110,533
社区成员
发帖
与我相关
我的任务
分享
public class TextBoxDropDown : TextBox
{
ToolStripDropDown dropDown = null;
public TextBoxDropDown()
{
dropDown = new ToolStripDropDown();
dropDown.Width = 50;
dropDown.Items.Add("aa");
dropDown.Items.Add("aaa");
dropDown.Items.Add("aab");
this.TextChanged += new EventHandler(TextBoxDropDown_TextChanged);
}
void TextBoxDropDown_TextChanged(object sender, EventArgs e)
{
//if (sender != null)
ShowDropDown();
}
private void ShowDropDown()
{
//try
//{
if (this.dropDown != null)
{
this.dropDown.Show(this, 0, Height);
//this.FindForm().GetNextControl(this, true).Focus();
}
//}
//catch (Exception ee)
//{
// string ss = ee.Message;
//}
}
}