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 do i dock a window to the bottom of the screen?

How do i dock a window to the bottom of the screen?

Scheduled Pinned Locked Moved C#
question
15 Posts 5 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.
  • T Tamimi Code

    try this on form load: this.Location = New Point(0, Screen.PrimaryScreen.Bounds.Height - thid.Height); this.Width = Screen.PrimaryScreen.Bounds.Width;

    When you get mad...THINK twice that the only advice Tamimi - Code

    J Offline
    J Offline
    jafingi
    wrote on last edited by
    #5

    I've tried this: private void Form1_Load(object sender, EventArgs e) { this.Location = New Point(0, Screen.PrimaryScreen.Bounds.Height - thid.Height); this.Width = Screen.PrimaryScreen.Bounds.Width; } But I get an error ; expected. Sorry if I've done it wrong, only made c# in 2 days ;)

    M 1 Reply Last reply
    0
    • J jafingi

      I've tried this: private void Form1_Load(object sender, EventArgs e) { this.Location = New Point(0, Screen.PrimaryScreen.Bounds.Height - thid.Height); this.Width = Screen.PrimaryScreen.Bounds.Width; } But I get an error ; expected. Sorry if I've done it wrong, only made c# in 2 days ;)

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #6

      Hello, I think you only made "fat finger" errors! ;) New -> new thid.Height -> this.Height

      		this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - this.Height);
      		this.Width = Screen.PrimaryScreen.Bounds.Width; 
      

      All the best, Martin

      J 1 Reply Last reply
      0
      • M Martin 0

        Hello, I think you only made "fat finger" errors! ;) New -> new thid.Height -> this.Height

        		this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - this.Height);
        		this.Width = Screen.PrimaryScreen.Bounds.Width; 
        

        All the best, Martin

        J Offline
        J Offline
        jafingi
        wrote on last edited by
        #7

        Thanks! It is working! BUT! I could't find the window.. Because it was placed behind the process bar (it was only because I got aero, that i could see it). Do you know how to fix that?

        K 1 Reply Last reply
        0
        • J jafingi

          Thanks! It is working! BUT! I could't find the window.. Because it was placed behind the process bar (it was only because I got aero, that i could see it). Do you know how to fix that?

          K Offline
          K Offline
          ken tachyon
          wrote on last edited by
          #8

          The problem is in the "Y" axis location. Remember Y = "down the screen". this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - this.Height); sets a location specified as x,y points. try: this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - (this.Height / 2) ); You should see your line in the middle of the screen. Adjust the second parameter to be where you want it.

          J 1 Reply Last reply
          0
          • K ken tachyon

            The problem is in the "Y" axis location. Remember Y = "down the screen". this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - this.Height); sets a location specified as x,y points. try: this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - (this.Height / 2) ); You should see your line in the middle of the screen. Adjust the second parameter to be where you want it.

            J Offline
            J Offline
            jafingi
            wrote on last edited by
            #9

            It didn't work perfect, but i tried to use: this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - (this.Height + 30)); And that works perfect. But! If i make the processbar bigger, it follows, but if i make it smaller, it is the same place as before, do you understand?

            P K 2 Replies Last reply
            0
            • J jafingi

              It didn't work perfect, but i tried to use: this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - (this.Height + 30)); And that works perfect. But! If i make the processbar bigger, it follows, but if i make it smaller, it is the same place as before, do you understand?

              P Offline
              P Offline
              PhilDanger
              wrote on last edited by
              #10

              Try this: this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

              J M 2 Replies Last reply
              0
              • P PhilDanger

                Try this: this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

                J Offline
                J Offline
                jafingi
                wrote on last edited by
                #11

                Doesn't work when i'm doing this: this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height); this.Width = Screen.PrimaryScreen.Bounds.Width; this.Height = 22; Have i made a mistake?

                P 1 Reply Last reply
                0
                • J jafingi

                  Doesn't work when i'm doing this: this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height); this.Width = Screen.PrimaryScreen.Bounds.Width; this.Height = 22; Have i made a mistake?

                  P Offline
                  P Offline
                  PhilDanger
                  wrote on last edited by
                  #12

                  Since the code I gave you uses the Height of the object, you need to set the height before executing that line. -- this.Height = 22; //this done first this.Width = Screen.PrimaryScreen.Bounds.Width; //moved here to keep height and width in the same code locations this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

                  J 1 Reply Last reply
                  0
                  • P PhilDanger

                    Since the code I gave you uses the Height of the object, you need to set the height before executing that line. -- this.Height = 22; //this done first this.Width = Screen.PrimaryScreen.Bounds.Width; //moved here to keep height and width in the same code locations this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

                    J Offline
                    J Offline
                    jafingi
                    wrote on last edited by
                    #13

                    Works perfect! Thank you very much!

                    1 Reply Last reply
                    0
                    • P PhilDanger

                      Try this: this.Location = new Point(0, Screen.PrimaryScreen.WorkingArea.Height - this.Height);

                      M Offline
                      M Offline
                      Martin 0
                      wrote on last edited by
                      #14

                      Very good idea with the WorkingArea. Never heard of it before! Got my 5 for that! All the best, Martin

                      1 Reply Last reply
                      0
                      • J jafingi

                        It didn't work perfect, but i tried to use: this.Location = new Point(0, Screen.PrimaryScreen.Bounds.Height - (this.Height + 30)); And that works perfect. But! If i make the processbar bigger, it follows, but if i make it smaller, it is the same place as before, do you understand?

                        K Offline
                        K Offline
                        ken tachyon
                        wrote on last edited by
                        #15

                        I couldn't respond to your email because you haven't confirmed your address. I'm glad to see you got your answer.

                        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