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. Form Location

Form Location

Scheduled Pinned Locked Moved C#
questionannouncement
2 Posts 2 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.
  • K Offline
    K Offline
    Kuira
    wrote on last edited by
    #1

    I tried getting the location from using Start Position via Centre Screen. But the results give me 0,0 for its location. How do I find its position? -- modified at 20:18 Tuesday 27th December, 2005 UPDATE: Ok, if i use centre screen, I cannot set its location differently unless I use manual, thus is there a way to find the StartPosition location somehow?

    P 1 Reply Last reply
    0
    • K Kuira

      I tried getting the location from using Start Position via Centre Screen. But the results give me 0,0 for its location. How do I find its position? -- modified at 20:18 Tuesday 27th December, 2005 UPDATE: Ok, if i use centre screen, I cannot set its location differently unless I use manual, thus is there a way to find the StartPosition location somehow?

      P Offline
      P Offline
      peshkunta
      wrote on last edited by
      #2

      There you go: //"this" refers to the current form object Point somePoint = this.PointToScreen(Location); //Note it calculates it from upper-left edge of the client area, not the border. I don't think there is a specific function to do that, but you can easily calculate it if you want the location of the form from the border. This is the width and height of the border in pixels: {X=3,Y=29}. Of course if you have tool border (smaller) it will be different. If you want to check that set the form start position to manual like so: this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; This will make your form/dialog box open in the upper-left edge of your screen. ______________________________ |_____________________________|<- form/dialog box border ||...........................................|| ||...........................................||<- form border ||.......................<-------------||--- client area ||...........................................|| ||...........................................|| ||___________________________|| -- Don't worry about the world coming to an end today. It's already tomorrow in Australia -- -- modified at 22:34 Tuesday 27th December, 2005

      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