By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,916 Members | 1,316 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,916 IT Pros & Developers. It's quick & easy.

Problem with BringToFront()

P: n/a
BringToFront() has the desired effect in my app if the notify icon's
(system tray icon's) context menu is used. However, I can't
BringToFront() in response to a Click event handler.

Here's the code:

private void showContextMenuItem_Click(object sender,
System.EventArgs e)
{
DoShow(); // BringToFront() in DoShow() will work here.
}

private void notifyIcon_Click(object sender, System.EventArgs e)
{
DoShow(); // BringToFront() in DoShow() DOES NOT work here.
}

private void DoShow()
{
Show();

if (WindowState == FormWindowState.Minimized) {
WindowState = FormWindowState.Normal;
}
BringToFront();
}

Anyone have an idea?
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
C# Learner <cs****@learner.here> wrote:

<snip>

Fixed it! Here's the new DoShow() method that works:

private void DoShow()
{
if (WindowState == FormWindowState.Minimized) {
WindowState = FormWindowState.Normal;
}
Activate();
}
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.