Announcement

Collapse
No announcement yet.

Symbol neben Uhr

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Symbol neben Uhr

    Hi,
    wie kann ich meine Programm so minimieren,dass es als Symbol neben der Uhr angezeigt wird?
    Ich konnte leider nirgens danach schen,weil ich nicht weiß wie sich das nennt.

  • #2
    Hallo,

    es reicht aus, die <b>NotifyIcon</b>-Komponente im Formular zu verbauen. Wenn die Anwendung vollständig ohne Formular auskommen soll, kann diese Klasse auch manuell verbaut werden:
    <pre>
    <b>using</b> System;
    <b>using</b> System.Windows.Forms; <font color="#003399"><i>// NotifyIcon</i></font>
    <b>using</b> System.Drawing; <font color="#003399"><i>// Icon</i></font>
    <br>
    <b>namespace</b> CSharpNotifyIconWithoutForm
    {
    <font color="#003399"><i>/// </i></font>
    <font color="#003399"><i>/// Summary description for ClassNotity.</i></font>
    <font color="#003399"><i>/// </i></font>
    <b>public</b> <b>class</b> ClassNotity
    {
    <b>public</b> ClassNotity()
    {
    <font color="#003399"><i>//</i></font>
    <font color="#003399"><i>// TODO: Add constructor logic here</i></font>
    <font color="#003399"><i>//</i></font>
    }
    <br>
    <b>public</b> <b>static</b> NotifyIcon aAppIcon = <b>new</b> NotifyIcon();
    <b>public</b> <b>static</b> ContextMenu aSysTrayMenu = <b>new</b> ContextMenu();
    <b>public</b> <b>static</b> MenuItem aDisplayInfo = <b>new</b> MenuItem(<font color="#9933CC">&quot;Info über...&quot;</font>);
    <b>public</b> <b>static</b> MenuItem aExitApp = <b>new</b> MenuItem(<font color="#9933CC">&quot;Beenden&quot;</font>);
    <br>
    <b>static</b> <b>void</b> Main()
    {
    Icon aIcon = <b>new</b> Icon(@<font color="#9933CC">&quot;D:\Daten\VisualStudio.NET\Co ntrols\NOTES.ICO&quot;</font>);
    aAppIcon.Icon = aIcon;
    <font color="#003399"><i>// MENU zuweisen </i></font>
    aExitApp.Click += <b>new</b> System.EventHandler(ExitApp_Click);
    aSysTrayMenu.MenuItems.Add(aDisplayInfo);
    aDisplayInfo.Click += <b>new</b> System.EventHandler(DisplayInfo_Click);
    aSysTrayMenu.MenuItems.Add(aExitApp);
    aAppIcon.ContextMenu = aSysTrayMenu;
    <font color="#003399"><i>// ToolTip-Text zuweisen</i></font>
    aAppIcon.Text = <font color="#9933CC">&quot;C# und NotifyIcon&quot;</font>;
    <font color="#003399"><i>// ICON in der Task Bar Notification Area (TBNA) anzeigen</i></font>
    aAppIcon.Visible = <b>true</b>;
    <font color="#003399"><i>// Anwendung starten</i></font>
    Application.Run();
    }
    <br>
    <b>private</b> <b>static</b> <b>void</b> DisplayInfo_Click(<b>object</b> sender, System.EventArgs e)
    {
    MessageBox.Show(<font color="#9933CC">&quot;NotifyIcon ohne Formular&quot;</font>, <font color="#9933CC">&quot;Text&quot;</font>,
    MessageBoxButtons.OK);
    }
    <br>
    <b>private</b> <b>static</b> <b>void</b> ExitApp_Click(<b>object</b> sender, System.EventArgs e)
    {
    Application.Exit();
    }
    }
    }
    </pre&gt

    Comment


    • #3
      Erstmal danke für deine Antwort, aber was muss ich machen wenn ich das notifyIcon auf dem Formular hab. Das hab ich jetzt aber da passiert ja so noch nicht viel

      Comment


      • #4
        also das hat sich wohl schon selbst erledigt, habs rausgefunden. muss ja einfach nur die main form unsichtbar machen und per notifyIcon_Click oder so wieder sichtbar.
        Aber bitte schaut mal auf meine anderes Problem,das mit den Symbolden als Auswahlpunkte

        Comment

        Working...
        X