当光标位于Winform中的图标上方时,如何使密码文本框的值可见

min*_*axi 1 c# textbox winforms

我正在winforms使用创建应用程序C#。现在,我想Icon在密码旁边加一个小眼睛,textbox以便当用户将鼠标悬停在时Icon,可以看到到目前为止输入的内容。因此,在悬停时,textbox应该显示,123并且当用户离开图标时,该框应***再次显示为。有什么办法做到这一点C#

Ale*_*lex 5

textBox.UseSystemPasswordChar = true;
icon.MouseEnter += (sender, e) => textBox.UseSystemPasswordChar = false;
icon.MouseLeave += (sender, e) => textBox.UseSystemPasswordChar = true;
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明