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. .NET (Core and Framework)
  4. How to hide the closing X on a windows form?

How to hide the closing X on a windows form?

Scheduled Pinned Locked Moved .NET (Core and Framework)
questionhelptutorial
3 Posts 2 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.
  • B Offline
    B Offline
    b0ksah
    wrote on last edited by
    #1

    I have a fire alert application that for no reason what so ever should be closed, this you can fix by adding the following in the Form_Closing event e.Cancel = true; But how do I hide the closing X icon? :confused:

    S 1 Reply Last reply
    0
    • B b0ksah

      I have a fire alert application that for no reason what so ever should be closed, this you can fix by adding the following in the Form_Closing event e.Cancel = true; But how do I hide the closing X icon? :confused:

      S Offline
      S Offline
      stevepham42
      wrote on last edited by
      #2

      The 'x' icon on the upper right is the control box. If you go to your form style, under windows style, change the ControlBox property to 'false'. Although i'm not sure if the user can still close the window by pressing alt-f4. You may need to intercept the key event for this. -Steve

      B 1 Reply Last reply
      0
      • S stevepham42

        The 'x' icon on the upper right is the control box. If you go to your form style, under windows style, change the ControlBox property to 'false'. Although i'm not sure if the user can still close the window by pressing alt-f4. You may need to intercept the key event for this. -Steve

        B Offline
        B Offline
        b0ksah
        wrote on last edited by
        #3

        When you disable the closing event then it don't care if you alt-f4... only thing that can close it is to kill the process in Task Manager. But thanks .. for the reply :)

        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