如何将新按钮添加到TextBox控件中

问题描述:



请帮帮我.

如何将新按钮添加到TextBox控件中?
如果单击该按钮,系统将显示一个新的筛选器"窗口?

如果您知道如何达到要求,请告诉我.

谢谢

Hi,

Please help me.

How do I add a new Button into the TextBox Control?
If you click the button the system will show a new Filter Windows?

If you know how to achieve the requirement, please let me know.

Thanks

您可以像这样在文本框中添加现有按钮.
You can add existing button in textbox like this.
Button Button1 = new Button();
Button1.Dock = Forms.DockStyle.Right;
TextBox1.Controls.Add(Button1);


您必须根据需要绑定按钮的事件.


You have to bind button''s event as required.

Button1.Click += new EventHandler(this.Button1_Click);



一个问题:这种方法可能会在按钮后面隐藏一些文本.最好将它们并排放置.



One problem: Some text may hide behind button with this approach. Better you place both side by side.


一种推测性的方式...您可以将TextBox和Button放入UserControl,更改其大小和位置,然后编写诸如"public"之类的内容事件EventHandler"...
A speculative way...you can put a TextBox and Button into a UserControl, change the size and location of it then write some thing like "public event EventHandler"...