如何将我的申请窗口放在前面?例如,我的应用程序需要关注哪些内容.
这是我个人的节目.我需要那种功能.
这就是我得到的.但它是NOT%工作的NOT%倍.
public void BringToFrontToEnterCaptha()
{
if (InvokeRequired)
{
Invoke(new Action(BringToFrontToEnterCaptha));
}
else
{
this.TopMost = true;
this.Focus();
this.BringToFront();
this.textBox1.Focus();
this.textBox1.Text = string.Empty;
System.Media.SystemSounds.Beep.Play();
}
}
public void BringToBackAfterEnterCaptha()
{
if (InvokeRequired)
{
Invoke(new Action(BringToBackAfterEnterCaptha));
}
else
{
this.TopMost = false;
}
}
我从后台工作人员那里给他们打了电话.
BringToFrontToEnterCaptha();
while (!ready)
{
Thread.Sleep(100);
}
BringToBackAfterEnterCaptha();
Thread.Sleep(300);
按下"接受"按钮后,布尔就绪设置为真.
我工作得很好,但并不总是这样.