【发布时间】:2021-12-13 22:53:27
【问题描述】:
// 使用 System.Runtime.InteropServices 添加引用;
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 Form1_Load(object sender, EventArgs e)
{
SendMessage(textBox_1.Handle, EM_SETCUEBANNER, 0, "long line");
SendMessage(textBox_2.Handle, EM_SETCUEBANNER, 0, "short line");
}
【问题讨论】:
-
@zaggler ;不用了,谢谢。如何在 C# 中更改文本框中的字体颜色?我搜索占位符水印..
标签: c# placeholder watermark