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, "请输入"); }