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. Launching a form with visible set to false

Launching a form with visible set to false

Scheduled Pinned Locked Moved C#
csharphelpdotnet
9 Posts 6 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
    Sharpoverride
    wrote on last edited by
    #1

    My problem : I use a notify icon on a form .. and I want to only show the notify icon and not the form ... but I didn't have any success cause the form tries to open as visible The only solutions I came up with are 1.to start a timer on form load 2.override the OnVisibleChange method and set visibble always to false I think the cause for the error is Application.Run( myform ) or probably an error with .NET Framework wich I doubt Is anybody else experiencing this or I 'm the only one who gets this king of errors . I tried to set visible false in the constructor but it still shows the form .. This error comes up in .Net 1.1 , 2.0 Beta2 , haven't tried it on 1.0.. but i'm pretty sure it's the same If you want to see that I'm write ... create a new C# project ... and in the form constructor write ,..... this.Visible = false ...... :laugh: :^) Ok... if someone can tell me why ... or if they have a more viable solution I'll whait for it Lazar Mihai Highschool student

    G D I C 4 Replies Last reply
    0
    • S Sharpoverride

      My problem : I use a notify icon on a form .. and I want to only show the notify icon and not the form ... but I didn't have any success cause the form tries to open as visible The only solutions I came up with are 1.to start a timer on form load 2.override the OnVisibleChange method and set visibble always to false I think the cause for the error is Application.Run( myform ) or probably an error with .NET Framework wich I doubt Is anybody else experiencing this or I 'm the only one who gets this king of errors . I tried to set visible false in the constructor but it still shows the form .. This error comes up in .Net 1.1 , 2.0 Beta2 , haven't tried it on 1.0.. but i'm pretty sure it's the same If you want to see that I'm write ... create a new C# project ... and in the form constructor write ,..... this.Visible = false ...... :laugh: :^) Ok... if someone can tell me why ... or if they have a more viable solution I'll whait for it Lazar Mihai Highschool student

      G Offline
      G Offline
      Gavin Jeffrey
      wrote on last edited by
      #2

      have you tried this.Opacity = 0;

      W 1 Reply Last reply
      0
      • G Gavin Jeffrey

        have you tried this.Opacity = 0;

        W Offline
        W Offline
        WillemM
        wrote on last edited by
        #3

        Unfortunatly this only works in win2k/xp/2k3 WM.
        What about weapons of mass-construction?

        G S 2 Replies Last reply
        0
        • W WillemM

          Unfortunatly this only works in win2k/xp/2k3 WM.
          What about weapons of mass-construction?

          G Offline
          G Offline
          Gavin Jeffrey
          wrote on last edited by
          #4

          Quite right you are. What about setting the size of the form to zero and the borderstyle to none then? form.Size = new Size(0,0); form.FormBorderStyle = FormBorderStyle.None;

          1 Reply Last reply
          0
          • S Sharpoverride

            My problem : I use a notify icon on a form .. and I want to only show the notify icon and not the form ... but I didn't have any success cause the form tries to open as visible The only solutions I came up with are 1.to start a timer on form load 2.override the OnVisibleChange method and set visibble always to false I think the cause for the error is Application.Run( myform ) or probably an error with .NET Framework wich I doubt Is anybody else experiencing this or I 'm the only one who gets this king of errors . I tried to set visible false in the constructor but it still shows the form .. This error comes up in .Net 1.1 , 2.0 Beta2 , haven't tried it on 1.0.. but i'm pretty sure it's the same If you want to see that I'm write ... create a new C# project ... and in the form constructor write ,..... this.Visible = false ...... :laugh: :^) Ok... if someone can tell me why ... or if they have a more viable solution I'll whait for it Lazar Mihai Highschool student

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

            Override the form's OnLoad and set the forms Visible property to false in there. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            S 1 Reply Last reply
            0
            • S Sharpoverride

              My problem : I use a notify icon on a form .. and I want to only show the notify icon and not the form ... but I didn't have any success cause the form tries to open as visible The only solutions I came up with are 1.to start a timer on form load 2.override the OnVisibleChange method and set visibble always to false I think the cause for the error is Application.Run( myform ) or probably an error with .NET Framework wich I doubt Is anybody else experiencing this or I 'm the only one who gets this king of errors . I tried to set visible false in the constructor but it still shows the form .. This error comes up in .Net 1.1 , 2.0 Beta2 , haven't tried it on 1.0.. but i'm pretty sure it's the same If you want to see that I'm write ... create a new C# project ... and in the form constructor write ,..... this.Visible = false ...... :laugh: :^) Ok... if someone can tell me why ... or if they have a more viable solution I'll whait for it Lazar Mihai Highschool student

              I Offline
              I Offline
              Iurii Okhmat
              wrote on last edited by
              #6

              U can use this code (with P/Invoke implemenstation): ..... using System.Runtime.InteropServices; ..... public class Form1 : System.Windows.Forms.Form { .... protected override void OnLoad(System.EventArgs e) { WIN32 win32 = new WIN32(); win32.HideWindow(this.Handle); } ... } public class WIN32 { public WIN32() { } public void HideWindow(System.IntPtr handle) { ShowWindow(handle,WindowShowStyle.Hide); } [DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, WindowShowStyle nCmdShow); private enum WindowShowStyle : uint { Hide = 0, ShowNormal = 1, ShowMinimized = 2, ShowMaximized = 3, Maximize = 3, ShowNormalNoActivate = 4, Show = 5, Minimize = 6, ShowMinNoActivate = 7, ShowNoActivate = 8, Restore = 9, ShowDefault = 10, ForceMinimized = 11 } } It will your main window... ;)

              1 Reply Last reply
              0
              • S Sharpoverride

                My problem : I use a notify icon on a form .. and I want to only show the notify icon and not the form ... but I didn't have any success cause the form tries to open as visible The only solutions I came up with are 1.to start a timer on form load 2.override the OnVisibleChange method and set visibble always to false I think the cause for the error is Application.Run( myform ) or probably an error with .NET Framework wich I doubt Is anybody else experiencing this or I 'm the only one who gets this king of errors . I tried to set visible false in the constructor but it still shows the form .. This error comes up in .Net 1.1 , 2.0 Beta2 , haven't tried it on 1.0.. but i'm pretty sure it's the same If you want to see that I'm write ... create a new C# project ... and in the form constructor write ,..... this.Visible = false ...... :laugh: :^) Ok... if someone can tell me why ... or if they have a more viable solution I'll whait for it Lazar Mihai Highschool student

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

                Leave out "myform" when you call Application.Run. ie: Application.Run(); -Chris

                1 Reply Last reply
                0
                • W WillemM

                  Unfortunatly this only works in win2k/xp/2k3 WM.
                  What about weapons of mass-construction?

                  S Offline
                  S Offline
                  Sharpoverride
                  wrote on last edited by
                  #8

                  I have XP ... there is where it doesn't work ... Lazar Mihai Highschool student

                  1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    Override the form's OnLoad and set the forms Visible property to false in there. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                    S Offline
                    S Offline
                    Sharpoverride
                    wrote on last edited by
                    #9

                    Overriding doesn't work ... I 've tried it ... it was probably the first thing I tried ... Lazar Mihai Highschool student

                    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