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 / C++ / MFC
  4. positioning problems

positioning problems

Scheduled Pinned Locked Moved C / C++ / MFC
questionvisual-studiohelptutorial
3 Posts 3 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    Other than repeated trial and error, how can I figure out the location of my control in code? I am putting two buttons on a CDialog that I want to line up under a couple of CListCtrls. I dont know how to size these since I dont know what areas I am working with. Does one somehow get the number of pixels manually from the IDE? Like if I knew the form is 600 pixels high, I would put my button at 500 pixels if its height is 50. I'm using stuff like:

    	m\_startsearch.MoveWindow(580,30,70,30);
    	m\_cancelsearch.MoveWindow(580,65,70,30);
    

    I dont know if getclientrect is helpful in this case since I want to position these buttons relative to two other controls on the form, which by trial and error I've positioned the way I want. So if I knew the actual number of pixels in my form I could do the adjustments I suppose. Any ideas on how to make this process more scientific? Thanks, ns

    B M 2 Replies Last reply
    0
    • N ns

      Other than repeated trial and error, how can I figure out the location of my control in code? I am putting two buttons on a CDialog that I want to line up under a couple of CListCtrls. I dont know how to size these since I dont know what areas I am working with. Does one somehow get the number of pixels manually from the IDE? Like if I knew the form is 600 pixels high, I would put my button at 500 pixels if its height is 50. I'm using stuff like:

      	m\_startsearch.MoveWindow(580,30,70,30);
      	m\_cancelsearch.MoveWindow(580,65,70,30);
      

      I dont know if getclientrect is helpful in this case since I want to position these buttons relative to two other controls on the form, which by trial and error I've positioned the way I want. So if I knew the actual number of pixels in my form I could do the adjustments I suppose. Any ideas on how to make this process more scientific? Thanks, ns

      B Offline
      B Offline
      Bill Wilson
      wrote on last edited by
      #2

      You can use CWnd::GetWindowRect to get the location of the controls you wish to align to.

      1 Reply Last reply
      0
      • N ns

        Other than repeated trial and error, how can I figure out the location of my control in code? I am putting two buttons on a CDialog that I want to line up under a couple of CListCtrls. I dont know how to size these since I dont know what areas I am working with. Does one somehow get the number of pixels manually from the IDE? Like if I knew the form is 600 pixels high, I would put my button at 500 pixels if its height is 50. I'm using stuff like:

        	m\_startsearch.MoveWindow(580,30,70,30);
        	m\_cancelsearch.MoveWindow(580,65,70,30);
        

        I dont know if getclientrect is helpful in this case since I want to position these buttons relative to two other controls on the form, which by trial and error I've positioned the way I want. So if I knew the actual number of pixels in my form I could do the adjustments I suppose. Any ideas on how to make this process more scientific? Thanks, ns

        M Offline
        M Offline
        Max Santos
        wrote on last edited by
        #3

        Use can use a simple way of resize/move controls in a complex dialog with this http://www.codeproject.com/dialog/easysize.asp[^] Casa.Sapo.pt

        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