如何基于文本框+按钮自定义控件? [英] how to custom control based on textbox +button?

查看:67
本文介绍了如何基于文本框+按钮自定义控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.500images.com/uploads/828398450controls.png

如何自定义控件(文本框和按钮)到一个控件?

功能:
1.当光标聚焦在文本框上时,该按钮将可见.
2.当光标失去对文本框的关注时,该按钮将不可见.

http://www.500images.com/uploads/828398450controls.png

How to custom control (textbox + button) to one control?

Feature:
1. when cursor focus on the textbox, then the button will visible.
2. when cursor lose focus on the textbox, the the button will invisible.

推荐答案

容易,很容易实现,但这不是一个好主意.例如,它将使鼠标无法访问该按钮,并使您的用户疯狂.

可以使用方法Control.OnLostFocusControl.OnGotFocus的重载或事件LostFocusGotFocus来实现.

—SA
Easy, very easy to implement, but this is a bad idea. For example, it will make the button not accessible by mouse and will drive your user crazy.

The implementation can be done using overloaded of the methods Control.OnLostFocus and Control.OnGotFocus or using the events LostFocus and GotFocus.

—SA


我想这很接近:
带有浏览按钮的文件搜索器编辑控件 [
I guess this one is pretty close:
File Searcher Edit Control with Browse Button[^] - just modify to suit your needs.

Best regards
Espen Harlinn


这篇关于如何基于文本框+按钮自定义控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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