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. Setting Text Controls X and Y Position in a Dialog Window

Setting Text Controls X and Y Position in a Dialog Window

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++questionvisual-studiolearning
8 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.
  • J Offline
    J Offline
    jerry1211a
    wrote on last edited by
    #1

    I have a Visual C++ application running in Visual Studio.net. It will have numerous dialog windows that will display labels and data. The labels and data will be displayed in Text Controls. There are IDC_XXX names for the labels and data. What I need to do is dynamically place the labels and data on the Windows dialog given X and Y coordinates. I cant use a static dialog in my rc resource file. QUESTION: Can I move the controls on the dialog given X, Y coordinates? If so, can someone tell me how this is done??...and how the X, Y system works in a dialog window. Where is 0,0 etc...?? Thanks, Jerry :)

    W D 2 Replies Last reply
    0
    • J jerry1211a

      I have a Visual C++ application running in Visual Studio.net. It will have numerous dialog windows that will display labels and data. The labels and data will be displayed in Text Controls. There are IDC_XXX names for the labels and data. What I need to do is dynamically place the labels and data on the Windows dialog given X and Y coordinates. I cant use a static dialog in my rc resource file. QUESTION: Can I move the controls on the dialog given X, Y coordinates? If so, can someone tell me how this is done??...and how the X, Y system works in a dialog window. Where is 0,0 etc...?? Thanks, Jerry :)

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      jerry1211a wrote:

      Where is 0,0 etc...??

      Just above and to the left of 1,1 Use SetWindowPos() or MoveWindow(), don't ask me for an example, ask your teacher.

      1 Reply Last reply
      0
      • J jerry1211a

        I have a Visual C++ application running in Visual Studio.net. It will have numerous dialog windows that will display labels and data. The labels and data will be displayed in Text Controls. There are IDC_XXX names for the labels and data. What I need to do is dynamically place the labels and data on the Windows dialog given X and Y coordinates. I cant use a static dialog in my rc resource file. QUESTION: Can I move the controls on the dialog given X, Y coordinates? If so, can someone tell me how this is done??...and how the X, Y system works in a dialog window. Where is 0,0 etc...?? Thanks, Jerry :)

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        jerry1211a wrote:

        Can I move the controls on the dialog given X, Y coordinates?

        Are you looking for MoveWindow() or SetWindowPos()?


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        J 1 Reply Last reply
        0
        • D David Crow

          jerry1211a wrote:

          Can I move the controls on the dialog given X, Y coordinates?

          Are you looking for MoveWindow() or SetWindowPos()?


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          J Offline
          J Offline
          jerry1211a
          wrote on last edited by
          #4

          Actually what I have is a dialog window with no controls at this point. I want to write text, numbers, etc to the window, using X, Y coordinates. I thought I could do this but have forgotten how... :) Jerry

          D 1 Reply Last reply
          0
          • J jerry1211a

            Actually what I have is a dialog window with no controls at this point. I want to write text, numbers, etc to the window, using X, Y coordinates. I thought I could do this but have forgotten how... :) Jerry

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            The only other way I know of is with TextOut() or DrawText().


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            J 1 Reply Last reply
            0
            • D David Crow

              The only other way I know of is with TextOut() or DrawText().


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              J Offline
              J Offline
              jerry1211a
              wrote on last edited by
              #6

              I can use that Ok, but I need to get the device context for the dialog I created. Is there a call to get the device context? Thanks. Jerry

              D 1 Reply Last reply
              0
              • J jerry1211a

                I can use that Ok, but I need to get the device context for the dialog I created. Is there a call to get the device context? Thanks. Jerry

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                jerry1211a wrote:

                Is there a call to get the device context?

                GetDC().


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                J 1 Reply Last reply
                0
                • D David Crow

                  jerry1211a wrote:

                  Is there a call to get the device context?

                  GetDC().


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  J Offline
                  J Offline
                  jerry1211a
                  wrote on last edited by
                  #8

                  Thank You... Have a good day. :)

                  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