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
  1. Home
  2. General Programming
  3. C#
  4. Hiding a winform just as it runs...

Hiding a winform just as it runs...

Scheduled Pinned Locked Moved C#
comquestion
3 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.
  • A Offline
    A Offline
    Alberto Bar Noy
    wrote on last edited by
    #1

    Hello all, I have a winform which I want to hide just after the InitializeComponent method is called. I tried using Hide() to no avail. Any insights? Thanks. Alberto Bar-Noy Software Engineer http://www.certagon.com

    D C 2 Replies Last reply
    0
    • A Alberto Bar Noy

      Hello all, I have a winform which I want to hide just after the InitializeComponent method is called. I tried using Hide() to no avail. Any insights? Thanks. Alberto Bar-Noy Software Engineer http://www.certagon.com

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Override the form's OnLoad procedure and change the Opacity to 0.0. You can't really Hide() or use Visible = false to do this. WHen you need to show the form again, change the Opacity back to 1.0. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      1 Reply Last reply
      0
      • A Alberto Bar Noy

        Hello all, I have a winform which I want to hide just after the InitializeComponent method is called. I tried using Hide() to no avail. Any insights? Thanks. Alberto Bar-Noy Software Engineer http://www.certagon.com

        C Offline
        C Offline
        cmaissan
        wrote on last edited by
        #3

        When Application.Run(myForm) is called, myForm is made visible. By this point the form has already been created and therefore its constructor and the InitializeComponent() method have already been called. Use Application.Run() instead of Application.Run(myForm). This will start the message loop without making any form visible. You will likely then want to add Application.ExitThread() to an event handler for the Closed event of your main form. -Chris

        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