Jump to content

Some difficult thigs for a new one

- - - - -

  • Please log in to reply
5 replies to this topic

#1
Frederik Van de Velde

Frederik Van de Velde

    Newbie

  • Members
  • Pip
  • 2 posts
Hi,

I'm coding for 2 days now and have 2 questions right now. How is it possible to show my app in the taskbar and when I minimize it it goes to the system tray with an icon.

Right now I can only show it in system tray and not both, or it won't dissapear when I minimize it. This is my code:
        private void Form1_Resize_1(object sender, EventArgs e)

        {

            Hide();

            if (WindowState==FormWindowState.Minimized)

            {

                notifyIcon1.BalloonTipText = "De applicatie is geminimaliseerd naar de system tray.";

                notifyIcon1.BalloonTipTitle = "Money";

                notifyIcon1.ShowBalloonTip(1000);

            }

        }


        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)

        {

            Show();

            WindowState = FormWindowState.Normal;

        }

The ShowInTaskbar is false is always set like that.

My second problem is when I double click the system tray icon, the app goes back to normal but minimize directly. If I double click a 2nd time it works.

As 3rd I'd like to load a browser like Chrome inside the a Windows Form. Is this possible?

If more code is needed, I can upload.

#2
Simonxz

Simonxz

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
Remove your Hide() and remove your Show(), you don't need them.

As for the browser, there's a control for it, use the WebBrowser and give it a URL in the properties.

#3
Frederik Van de Velde

Frederik Van de Velde

    Newbie

  • Members
  • Pip
  • 2 posts
Well, if I remove the show and hide I get this, but I want it completely gone when minimized:

Attached File  Naamloos.png   13.61K   7 downloads

#4
Simonxz

Simonxz

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
You can put your Hide() in your if then, it'll fix your other problem, but the problem is you won't be able to see it in the taskbar at the same time because Hide() hides everything. I think the behaviour you are getting only happens on Windows 7.

#5
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
Use the "ShowInTaskbar" property to control whether the form is shown in the taskbar when it's minimized. Set:

ShowInTaskbar = false;

when you want to hide it on minimize, and:

ShowInTaskbar = true;

when you want to bring it back on restore.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid


#6
Simonxz

Simonxz

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
@gregwarner: When you Hide() a form, it won't show up in the taskbar no matter what the property "ShowInTaskbar" is set to




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users