내 최종 프로젝트의 경우 암호를 생성하는 암호 생성기를 만들고 로컬 압축 DB (.sdf)에 저장할지 여부를 선택할 수 있습니다. . 지금 GUI에서 작업하고 있습니다. 암호 용 강도 표시 줄을 만들었지 만 문제는 처음에는 슬라이더를 움직이지 않고 강도 표시 줄을 업데이트 할 수없는 것입니다. 내가 말하는 것에 대한 예를 보여 드리겠습니다. 코드 또는 액션 이벤트로이 작업을 수행 할 수 있는지 궁금합니다. 네 생각은 어떤지 말해봐. 아래는 GUI 디자이너를위한 코드입니다. 이것이 좋은 생각이거나 더 좋은 방법이있을 것이라고 생각합니까? 초점 아이디어는 창에 초점이있는 경우 옵션을 계속 확인하고 변경 사항이 있는지 확인합니다. 비디오 : 음 http://youtu.be/ihSeKbsL55Mfocus-Password Generator 창을 확인하십시오 C#
namespace PasswordGenerator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void fileToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void quitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void quitToolStripMenuItem1_Click(object sender, EventArgs e)
{
this.Close();
}
private void bcopy_Click(object sender, EventArgs e)
{
if (passwordGenBox.Text.Length != 0)
{
Clipboard.SetText(passwordGenBox.Text);
}
else
{
MessageBox.Show("No Password Generated.", "Copy Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void bclear_Click(object sender, EventArgs e)
{
passwordGenBox.Text = "";
}
private void lengthSlider_Scroll(object sender, EventArgs e)
{
sliderLength.Text = lengthSlider.Value.ToString();
int str = lengthSlider.Value;
bool scheck = symCheck.Checked;
bool ncheck = numbersCheck.Checked;
//1-10 no symbols or numbers
if (str > 0 && str <= 10)
{
strLabel.Text = "Week";
}
//1-10 symbols no numbers
if (str > 0 && str <= 10 && scheck == true && ncheck == false)
{
strLabel.Text = "Alright";
}
//1-10 no symbols but numbers
if (str > 0 && str <= 10 && scheck == false && ncheck == true)
{
strLabel.Text = "Week";
}
//1-10 symbols & numbers
if (str > 0 && str <= 10 && scheck == true && ncheck == true)
{
strLabel.Text = "Okay";
}
}
private void bgen_Click(object sender, EventArgs e)
{
int pwlength = lengthSlider.Value;
bool symbols = false;
bool numbers = false;
if (symCheck.Checked && numbersCheck.Checked)
{
symbols = true;
numbers = true;
}
else if (symCheck.Checked && numbersCheck.Checked == false)
{
symbols = true;
numbers = false;
}
else if (symCheck.Checked == false && numbersCheck.Checked)
{
symbols = false;
numbers = true;
}
else
{
symbols = false;
numbers = false;
}
Generator gen = new Generator(pwlength, symbols, numbers);
}
}
}
정말로 묻고있는 것을 명확히 할 수 있습니까? 당신은 "그러나 문제는 슬라이더를 먼저 움직이지 않으면 강도 막대를 업데이트 할 수 없다는 것입니다." 그러나 강도를 업데이트하는 코드가 Slider의 Scroll 이벤트 안에 있기 때문에 그것이 업데이트 될 때가 된 것 같습니다. ?? – Tim
Daniel은 실제로 내가 찾고있는 것과 정확히 일치했습니다. 나는 그것들을 다른 기능들에 넣어야 만한다. – seandidk