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, "請輸入");
     
    }
相關文章
相關標籤/搜索