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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to position the controls in a view?

How to position the controls in a view?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionc++helplearning
4 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.
  • B Offline
    B Offline
    ben2
    wrote on last edited by
    #1

    Hi, I have 2 very basic questions about MFC. 1. How can I position a control in a view from the program (not using resource editor), for example in a TreeView, I want to position the treecontrol starting from (0, rect.height()/18) coordinate. 2. If I resize the parent window how can I have the controls resize themselves? (which function in the view to be changed?) Please help

    C V 2 Replies Last reply
    0
    • B ben2

      Hi, I have 2 very basic questions about MFC. 1. How can I position a control in a view from the program (not using resource editor), for example in a TreeView, I want to position the treecontrol starting from (0, rect.height()/18) coordinate. 2. If I resize the parent window how can I have the controls resize themselves? (which function in the view to be changed?) Please help

      C Offline
      C Offline
      CodeBrain
      wrote on last edited by
      #2

      1.You can use CWnd::SetWindowPos to set the position of a window. 2. I would use CWnd::OnSize in the parent class. The framework calls this member function after the window’s size has changed. Change the size of the child windows is in this method. You will find details about the mthods in the MSDN library.

      B 1 Reply Last reply
      0
      • C CodeBrain

        1.You can use CWnd::SetWindowPos to set the position of a window. 2. I would use CWnd::OnSize in the parent class. The framework calls this member function after the window’s size has changed. Change the size of the child windows is in this method. You will find details about the mthods in the MSDN library.

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

        Thanks for yur reply. I tried to use following the function as follows, but, I can't see the tree in the view, I'm sure it's under the control on top of it which occupying the 1/18 height from top. Please help CTreeCtrl& tree = GetTreeCtrl(); tree.SetWindowPos (&cMyTabCtrl, 0, cr.Height()/18, cr.Width(), cr.Height()*17/18, SWP_DRAWFRAME);

        1 Reply Last reply
        0
        • B ben2

          Hi, I have 2 very basic questions about MFC. 1. How can I position a control in a view from the program (not using resource editor), for example in a TreeView, I want to position the treecontrol starting from (0, rect.height()/18) coordinate. 2. If I resize the parent window how can I have the controls resize themselves? (which function in the view to be changed?) Please help

          V Offline
          V Offline
          Vitali Halershtein
          wrote on last edited by
          #4

          Hi, You also can try to use MoveWindow insted SetWindowPos. May be it will solve your problems. Vitali http://www.creative-case.com[^]

          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