鼠标悬停时带有下拉列表的文本框 [英] textbox with dropdownlist on mouse over

查看:238
本文介绍了鼠标悬停时带有下拉列表的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
朋友

我的任务是

我有一个文本框,当我在文本框上移动鼠标时,它会像右端的按钮一样显示;当我单击按钮时,当鼠标移到文本框后,下拉列表项将显示,它会像文本框本身一样显示.


请帮助

hi
friends

my task is

i have one text box when i move mouse on text box it will display like button on right end ,when i click on button drop down list items will displayed after mouse will removed on the text box it will show like text box itself.


please help

推荐答案


为什么在这种情况下不使用comboBox?
试试这个,

使用comboBox控件,在comboBox的MouseEnter事件和MouseLeave事件下编写以下代码.

Hi,
why don''t you use comboBox for this type of situation.
try this one,

take a comboBox control, write the following code under the MouseEnter event and MouseLeave events of comboBox.

private void comboBox1_MouseEnter(object sender, EventArgs e)
        {
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
        }

        private void comboBox1_MouseLeave(object sender, EventArgs e)
        {
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
        }


并在Form Load事件下编写以下代码


And also write the following code under the Form Load event

private void Form1_Load(object sender, EventArgs e)
        {
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
        }


希望对您有帮助.


I hope this helps to you.


这篇关于鼠标悬停时带有下拉列表的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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