我想双击textbox,弹出一个窗口进行操作,但是textbox没有双击事件,如何实现?请高手指点!使用VS2010,C#

解决方案 »

  1.   

    有双击事件的
    http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doubleclick%28VS.100%29.aspx如果是web程序,则是使用
    textbox1.Attributes.Add("ondblclick","js函数()")
      

  2.   

    this.textBox1.DoubleClick += new System.EventHandler(this.textBox1_DoubleClick);private void textBox1_DoubleClick(object sender, EventArgs e)
        {
          MessageBox.Show("xxx");
        }
      

  3.   

    Web程序的例子
    <%@ Page Language="C#" AutoEventWireup="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
      protected void Page_Load(object sender, EventArgs e)
      {
        TextBox1.Attributes.Add("ondblclick", "alert('ok')");
      }
     
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
      <title>无标题页</title>  
    </head>
    <body>
      <form id="form1" runat="server">
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
      </form>
    </body>
    </html>
      

  4.   

    类似这个
    http://topic.csdn.net/u/20120907/23/dc3e9358-2080-4dfd-9d19-b31f2b467ffd.html