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. how to start a form in a specific location

how to start a form in a specific location

Scheduled Pinned Locked Moved C#
questiontutorial
7 Posts 4 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
    BDJones
    wrote on last edited by
    #1

    I would like to start a second form relative to the first form. frmMain is the first form, frmView2 is the second form being opened by frmMain:

    frmView2 FView2 = new frmView2();   
    FView2.Show();
    

    In frmView2 I have:

    this.Location = windowpoint;
    

    How do I properly pass a Point from frmMain to frmView2? Thank you

    C L 2 Replies Last reply
    0
    • B BDJones

      I would like to start a second form relative to the first form. frmMain is the first form, frmView2 is the second form being opened by frmMain:

      frmView2 FView2 = new frmView2();   
      FView2.Show();
      

      In frmView2 I have:

      this.Location = windowpoint;
      

      How do I properly pass a Point from frmMain to frmView2? Thank you

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You have to set the starting location ( there's a property, and I forget it, sorry ), before you show it. You can set it to center screen, center parent, or you can set it to manual, and then setting the position will work.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      B H 2 Replies Last reply
      0
      • C Christian Graus

        You have to set the starting location ( there's a property, and I forget it, sorry ), before you show it. You can set it to center screen, center parent, or you can set it to manual, and then setting the position will work.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

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

        I have the starting position. The starting point is the point I'm trying to pass from the first form. How do I pass that point per my OP?

        1 Reply Last reply
        0
        • C Christian Graus

          You have to set the starting location ( there's a property, and I forget it, sorry ), before you show it. You can set it to center screen, center parent, or you can set it to manual, and then setting the position will work.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          H Offline
          H Offline
          hotthoughtguy
          wrote on last edited by
          #4

          this.StartPosition = FormStartPosition.CenterScreen;

          1 Reply Last reply
          0
          • B BDJones

            I would like to start a second form relative to the first form. frmMain is the first form, frmView2 is the second form being opened by frmMain:

            frmView2 FView2 = new frmView2();   
            FView2.Show();
            

            In frmView2 I have:

            this.Location = windowpoint;
            

            How do I properly pass a Point from frmMain to frmView2? Thank you

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi, 1. you need to set Form.StartPosition to Manual 2. you could pass a Point through a second Form constructor, through a new property, and many other ways. However, you don't have to, you could also set the position in the main form, just before showing the new one. :)

            Luc Pattyn


            I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


            B 1 Reply Last reply
            0
            • L Luc Pattyn

              Hi, 1. you need to set Form.StartPosition to Manual 2. you could pass a Point through a second Form constructor, through a new property, and many other ways. However, you don't have to, you could also set the position in the main form, just before showing the new one. :)

              Luc Pattyn


              I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


              B Offline
              B Offline
              BDJones
              wrote on last edited by
              #6

              I set the point with this.Location in the first form and set the adjusted point just before frmView2.Show thanks!!

              L 1 Reply Last reply
              0
              • B BDJones

                I set the point with this.Location in the first form and set the adjusted point just before frmView2.Show thanks!!

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                you're welcome. :)

                Luc Pattyn


                I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                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