本文整理匯總了C#中System.Windows.Forms.MaskedTextBox.ResumeLayout方法的典型用法代碼示例。如果您正苦於以下問題:C# MaskedTextBox.ResumeLayout方法的具體用法?C# MaskedTextBox.ResumeLayout怎麽用?C# MaskedTextBox.ResumeLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.MaskedTextBox
的用法示例。
在下文中一共展示了MaskedTextBox.ResumeLayout方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Password
/// <summary>
/// force means ignore any cache and require the user to enter a password
/// </summary>
/// <param name="prompt"></param>
/// <param name="force"></param>
/// <returns></returns>
public static string Password(string prompt, bool requireEntry)
{
string passwordFileName;
if (!string.IsNullOrWhiteSpace(prompt))
{
if (ProcessFunctions.KeplerProcess != null)
{
passwordFileName = SwishFunctions.GeneratePasswordFileName(prompt, ProcessFunctions.KeplerProcess);
passwordFileName = Path.Combine(Path.GetTempPath(), passwordFileName);
if (!requireEntry && FileFunctions.FileExists(passwordFileName))
{
string _encodedPassword = File.ReadAllText(passwordFileName);
string _password = SwishFunctions.DecodePassword(_encodedPassword, ProcessFunctions.KeplerProcess);
return _password;
}
} else
{
passwordFileName = string.Empty;
}
} else
{
prompt = "Please enter password";
passwordFileName = string.Empty;
}
string password;
using (MaskedTextBox textBox = new MaskedTextBox())
using (Panel panel = new Panel())
using (Button buton = new Button())
using (Form form = new Form())
{
textBox.SuspendLayout();
buton.SuspendLayout();
panel.SuspendLayout();
form.SuspendLayout();
textBox.UseSystemPasswordChar = true;
textBox.Multiline = true;
textBox.SelectionStart = 0;
textBox.SelectionLength = 0;
textBox.Size = new Size(300, textBox.Height);
textBox.Dock = DockStyle.Top;
textBox.Font = new Font(textBox.Font, FontStyle.Bold);
textBox.TabIndex = 0;
buton.Click += new EventHandler(buton_Click);
buton.Dock = DockStyle.Left;
buton.Text = "Ok";
buton.Size = new Size(75, 23);
buton.TabIndex = 0;
panel.Height = 23;
panel.Controls.Add(buton);
panel.Dock = DockStyle.Fill;
panel.TabIndex = 1;
form.ControlBox = false;
form.Text = prompt;
form.ClientSize = new Size(300, 43);
form.Controls.Add(panel);
form.Controls.Add(textBox);
form.AcceptButton = buton;
textBox.ResumeLayout();
buton.ResumeLayout();
panel.ResumeLayout();
form.ResumeLayout();
textBox.Focus();
form.ShowDialog();
password = textBox.Text;
}
if (string.IsNullOrWhiteSpace(password))
{
return string.Empty;
}
if (string.IsNullOrWhiteSpace(passwordFileName))
{
return password;
}
string encodedPassword = SwishFunctions.EncodePassword(password, ProcessFunctions.KeplerProcess);
if (File.Exists(passwordFileName))
{
FileFunctions.DeleteFile(passwordFileName, null);
}
File.WriteAllText(passwordFileName, encodedPassword);
return password;
//.........這裏部分代碼省略.........