效果展示

核心代码
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
public static void SetHintText(Control control, string text)
{
SendMessage(control.Handle, 0x1501, 0, text);
}
public FrmUpdataPassword()
{
InitializeComponent();
SetHintText(txt_OldPassword, "初始密码为:123456");
SetHintText(txt_NewPassword, $"6-{txt_NewPassword.MaxLength}位数字或字母");
btn_Enter.Focus();
}
private void chb_ShowPassword_CheckedChanged(object sender, EventArgs e)
{
txt_NewPassword.UseSystemPasswordChar = !chb_ShowPassword.Checked;