Opening form invisible

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Opening form invisible

    Hi

    Is there a way to open a form hidden/invisible while it is populating its
    controls, and then make it visible once it is done? I am using the following
    code but the form remains visible.

    cform = New frmClients
    cform.Visible = False ' this does not seem to make form hidden (not
    visible)
    cform.TopLevel = False
    Me.FormsPanel.C ontrols.Add(cfo rm) 'Me is a main/parent form
    cform.Show()
    cform.BringToFr ont()
    cform.Visible = True

    Thanks

    Regards


  • Cor Ligthert

    #2
    Re: Opening form invisible

    Hi John,

    When you do your loading in the "load" event from the form, it is invisible
    untill that is ready. The first event with a visible form I use is the form
    activated.

    I hope this helps?

    Cor


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: Opening form invisible

      * "John" <john@nospam.in fovis.co.uk> scripsit:[color=blue]
      > Is there a way to open a form hidden/invisible while it is populating its
      > controls, and then make it visible once it is done? I am using the following
      > code but the form remains visible.
      >
      > cform = New frmClients
      > cform.Visible = False ' this does not seem to make form hidden (not
      > visible)
      > cform.TopLevel = False
      > Me.FormsPanel.C ontrols.Add(cfo rm) 'Me is a main/parent form[/color]

      The form will remain invisible until the execution of the next line.
      [color=blue]
      > cform.Show()
      > cform.BringToFr ont()
      > cform.Visible = True[/color]

      The last line doesn't make sense because the form is already visible.

      --
      Herfried K. Wagner [MVP]
      <URL:http://dotnet.mvps.org/>

      Comment

      • John

        #4
        Re: Opening form invisible

        The problem is that I see the controls being painted one by one. Can I not
        keep the form hidden until all controls are painted during the first form
        loading?

        Thanks

        Regards


        "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
        news:OD60m1JJEH A.2672@TK2MSFTN GP10.phx.gbl...[color=blue]
        > * "John" <john@nospam.in fovis.co.uk> scripsit:[color=green]
        > > Is there a way to open a form hidden/invisible while it is populating[/color][/color]
        its[color=blue][color=green]
        > > controls, and then make it visible once it is done? I am using the[/color][/color]
        following[color=blue][color=green]
        > > code but the form remains visible.
        > >
        > > cform = New frmClients
        > > cform.Visible = False ' this does not seem to make form hidden[/color][/color]
        (not[color=blue][color=green]
        > > visible)
        > > cform.TopLevel = False
        > > Me.FormsPanel.C ontrols.Add(cfo rm) 'Me is a main/parent form[/color]
        >
        > The form will remain invisible until the execution of the next line.
        >[color=green]
        > > cform.Show()
        > > cform.BringToFr ont()
        > > cform.Visible = True[/color]
        >
        > The last line doesn't make sense because the form is already visible.
        >
        > --
        > Herfried K. Wagner [MVP]
        > <URL:http://dotnet.mvps.org/>[/color]


        Comment

        • John

          #5
          Re: Opening form invisible

          The problem is that I see the controls being painted one by one. Can I not
          keep the form hidden until all controls are painted during the first form
          loading?

          Thanks

          Regards

          "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
          news:e5XEkuJJEH A.3040@TK2MSFTN GP09.phx.gbl...[color=blue]
          > Hi John,
          >
          > When you do your loading in the "load" event from the form, it is[/color]
          invisible[color=blue]
          > untill that is ready. The first event with a visible form I use is the[/color]
          form[color=blue]
          > activated.
          >
          > I hope this helps?
          >
          > Cor
          >
          >[/color]


          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: Opening form invisible

            * "John" <john@nospam.in fovis.co.uk> scripsit:[color=blue]
            > The problem is that I see the controls being painted one by one. Can I not
            > keep the form hidden until all controls are painted during the first form
            > loading?[/color]

            Google for 'SendMessage' + 'WM_SETREDRAW', maybe this will work for you.

            --
            Herfried K. Wagner [MVP]
            <URL:http://dotnet.mvps.org/>

            Comment

            • One Handed Man \( OHM#\)

              #7
              Re: Opening form invisible

              Private Sub CreateForm_Clic k(ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles Button1.Click

              ' mhf is a form declared at class level

              mhf.Visible = False

              For x As Integer = 0 To 20

              mhf.Controls.Ad d(New Windows.Forms.B utton)

              Next

              End Sub

              Private Sub MakeVisible_Cli ck(ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles Button2.Click

              mhf.Visible = True

              End Sub

              End Class

              "John" <john@nospam.in fovis.co.uk> wrote in message
              news:ugbFesJJEH A.3120@TK2MSFTN GP09.phx.gbl...[color=blue]
              > Hi
              >
              > Is there a way to open a form hidden/invisible while it is populating its
              > controls, and then make it visible once it is done? I am using the[/color]
              following[color=blue]
              > code but the form remains visible.
              >
              > cform = New frmClients
              > cform.Visible = False ' this does not seem to make form hidden (not
              > visible)
              > cform.TopLevel = False
              > Me.FormsPanel.C ontrols.Add(cfo rm) 'Me is a main/parent form
              > cform.Show()
              > cform.BringToFr ont()
              > cform.Visible = True
              >
              > Thanks
              >
              > Regards
              >
              >[/color]


              Comment

              Working...