WPF中的密码框
WPF中的密码框
XAML文件
<PasswordBox Name="PasswordBox" Margin="5" Padding="5" PreviewKeyDown="Txtpassword_PreviewKeyUp"/>
后台代码:
IntPtr p = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this.PasswordBox.SecurePassword);
string password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(p);
撸码:复制、粘贴,拿起键盘就是“干”!!!

浙公网安备 33010602011771号