文本框内的图像按钮 [英] Image Button inside the Text Box

查看:99
本文介绍了文本框内的图像按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试用搜索文本框之类的按钮创建一个文本框。

请帮助我。

解决方案

最好的方法是创建一个包含文本框和图像按钮的UserControl - 然后你有一个项目,而不是生成点击事件,并具有你需要的文本属性。



易于操作:右键单击您的项目并选择添加...用户控制。

给它一个合理的名称,然后按确定。

删除文本表面上的框和一个按钮 - 适当地排列和调整所有内容。

然后添加一个Text Property,它获取并设置Textbox.Text值,以及一个新的Click事件。

处理按钮Click事件,并使用它来发出新控件Click事件的信号。 (这个提示应该有所帮助:添加事件的简单代码片段 [ ^ ] - 它显示你需要为活动添加的代码)

构建你的应用程序,控件应该出现在工具箱中 - 将它放在你的表单上,你就是远<!/ BLOCKQUOTE>

I want to try make a text box with button like search text box.
Please help me.

解决方案

The best way is to create a UserControl which contains a Text Box and an image button - you then have a single item than can generate Click events and has the Text property you need.

Easy to do: Right click your project and select "Add"..."User Control".
Give it a sensible name, and press OK.
Drop a text box on the surface, and a button - arrange and size everything appropriately.
Then add a Text Property which gets and sets the Textbox.Text value, and a new Click event.
Handle the button Click event, and use that to signal the new controls Click event. (This tip should help: A Simple Code Snippet to Add an Event[^] - it shows teh code you need to add for the event)
Build you app, and the control should appear in the toolbox - drop it on your form and you are away!


这篇关于文本框内的图像按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆