textbox水印提示文字一种方式

 private const int EM_SETCUEBANNER = 0x1501;
    [DllImport("user32.dll", CharSet = CharSet.Auto)]

    private static extern Int32 SendMessage
      (IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
    private void Form6_Load(object sender, EventArgs e)
    {
      SendMessage(textBox1.Handle, EM_SETCUEBANNER, 0, "请输入");
      SendMessage(textBox2.Handle, EM_SETCUEBANNER, 0, "请输入");
     
    }

 

posted on 2015-07-21 16:20  酒歌  阅读(381)  评论(0编辑  收藏  举报