Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how to override close

how to override close

Scheduled Pinned Locked Moved C#
questiontutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephan Wright
    wrote on last edited by
    #1

    Hy everyone! I do want to overide the red cross for closing in my Windows.Form. I managed to do so by using e.Cancel=false in my code but well then it cancels every closecommand, meaning it cancels my command for closing via a button or via the menuitem of my trayicon. Well what I want to do is: If the user clicks the read cross (WinXP Style!) then the minimize operation is called. If the user clicks the button "Close" (on my Form) the the application is quit and if the user selects "Close" from my contextmenu of the trayicon then the application quits as well. But well how do I separate these three events, so the last two really close my application and the first one minimizes? Thanks! Stephan.

    E L 2 Replies Last reply
    0
    • S Stephan Wright

      Hy everyone! I do want to overide the red cross for closing in my Windows.Form. I managed to do so by using e.Cancel=false in my code but well then it cancels every closecommand, meaning it cancels my command for closing via a button or via the menuitem of my trayicon. Well what I want to do is: If the user clicks the read cross (WinXP Style!) then the minimize operation is called. If the user clicks the button "Close" (on my Form) the the application is quit and if the user selects "Close" from my contextmenu of the trayicon then the application quits as well. But well how do I separate these three events, so the last two really close my application and the first one minimizes? Thanks! Stephan.

      E Offline
      E Offline
      exhaulted
      wrote on last edited by
      #2

      Stephan, in the button.click event use Application.Exit() instead of MyForm.Close() Kev Pearman MCP

      S 1 Reply Last reply
      0
      • S Stephan Wright

        Hy everyone! I do want to overide the red cross for closing in my Windows.Form. I managed to do so by using e.Cancel=false in my code but well then it cancels every closecommand, meaning it cancels my command for closing via a button or via the menuitem of my trayicon. Well what I want to do is: If the user clicks the read cross (WinXP Style!) then the minimize operation is called. If the user clicks the button "Close" (on my Form) the the application is quit and if the user selects "Close" from my contextmenu of the trayicon then the application quits as well. But well how do I separate these three events, so the last two really close my application and the first one minimizes? Thanks! Stephan.

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        Try using Application.Exit to really KILL it :) top secret xacc-ide 0.0.1

        1 Reply Last reply
        0
        • E exhaulted

          Stephan, in the button.click event use Application.Exit() instead of MyForm.Close() Kev Pearman MCP

          S Offline
          S Offline
          Stephan Wright
          wrote on last edited by
          #4

          Thanks! It works! :-) Stephan.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups