Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

ich möchte nun gern etwas mit Contextmenü's arbeiten.

Ich rufe einfach diesen Code in der MouseClick Methode auf:


                ContextMenu c = new ContextMenu();

                c.MenuItems.Add("Bearbeiten");

                c.MenuItems.Add("Löschen");

                c.Show(livEmployee, e.Location);

Wie kann ich herausfinden, was geklickt wurde? Soetwas wie c.Click gibt es nicht :(

Danke!

Hallo

du musst dem Steuerelement, für das du das ContextMenue erstellt hast sagen, dass dieses Contextmenü zu dem Steuerelement gehört. Siehe Eigenschaften (ContextMenuStrip)

Gruß Hans-Jörg

P.S. Erstelle KEIN ContextMenue sondern ContextMenuStrip ;)

Hallo,

willst du das 'Click'-Event auf den einzelnen Einträgen haben?

Wenn Ja wäre der einfachste Weg:


private void Mouse_Click(object sender, MouseClickEventArgs e)

{

      ContextMenuStrip c = new ContextMenuStrip();

      c.Items.Add("Bearbeiten").Click += new EventHandler(Bearbeiten_Click);

      c.Items.Add("Löschen").Click    += new EventHandler(Loeschen_Click);

      c.Show((Control)sender, e.Location);

}


void Loeschen_Click(object sender, EventArgs e)

{

      //Dein Code

}


void Bearbeiten_Click(object sender, EventArgs e)

{

      //Dein Code

}

Hoffe das ist das was du suchst.

Grüße ToolsDevler

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.