chris-s
10/15/2003 7:26:00 AM
Hi Lloyd,
I did something similar using the code snippet below, tho I don't know what
the cpu usage looks like. You may find it useful.
Chris
private void ShowPanelAsModalDialog(Panel APanel)
{
m_dialogResult = DialogResult.Cancel;
APanel.BringToFront();
APanel.Show();
m_dialogPanel = APanel;
//timer1.Interval = 250;
timer1.Enabled = true;
while (timer1.Enabled)
{
Application.DoEvents();
}
}
private void timer1_Tick(object sender, System.EventArgs e)
{
timer1.Enabled = m_dialogPanel.Visible;
}
private void Dialog_Cancel_Click(object sender, System.EventArgs e)
{
m_dialogResult = DialogResult.Cancel;
m_dialogPanel.Hide();
}
private void Dialog_OK_Click(object sender, System.EventArgs e)
{
m_dialogResult = DialogResult.OK;
m_dialogPanel.Hide();
}
"Lloyd Dupont" <net.galador@ld> wrote in message
news:u2X6gvqkDHA.2244@TK2MSFTNGP12.phx.gbl...
> I'm doing kind of custom ShowDialog() function, for a class of popping
> control.
>
> roughly in it I have
> ShowModal()
> {
> BringToFront()
> modal = true;
> while(modal)
> Application.DoEvents();
> }
>
> the problem is, when I tru this on the desktop my CPU usage goes up to
100%
> I try to add a Thread.Sleep() before DoEvents(), but that doesn't help.
>
> any way of doing that without having a 100% CPU usage ?
>
>