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. How to move Bitmap in Dialog ?

How to move Bitmap in Dialog ?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorialquestion
5 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.
  • M Offline
    M Offline
    Morris_Pan
    wrote on last edited by
    #1

    Dear Excellence: I want to move the bitmap in Dialog by presseing button, can you show me how to do it? Thanks. Morris X| Morris Pan

    S 1 Reply Last reply
    0
    • M Morris_Pan

      Dear Excellence: I want to move the bitmap in Dialog by presseing button, can you show me how to do it? Thanks. Morris X| Morris Pan

      S Offline
      S Offline
      SJolly
      wrote on last edited by
      #2

      In the handler for the button press, put something along these lines: RECT stNewPosition; // setup the new position for the bitmap (this can also resize it) stNewPosition.top = 50; stNewPosition.left = 50; // etc... // this moves the bitmap only GetDlgItem(IDB_YOUR_BITMAP)->MoveWindow(&stNewPosition, TRUE); I think you can move the image off your dialog with this - effectively making it vanish so beware. Regards, Simon

      M 2 Replies Last reply
      0
      • S SJolly

        In the handler for the button press, put something along these lines: RECT stNewPosition; // setup the new position for the bitmap (this can also resize it) stNewPosition.top = 50; stNewPosition.left = 50; // etc... // this moves the bitmap only GetDlgItem(IDB_YOUR_BITMAP)->MoveWindow(&stNewPosition, TRUE); I think you can move the image off your dialog with this - effectively making it vanish so beware. Regards, Simon

        M Offline
        M Offline
        Morris_Pan
        wrote on last edited by
        #3

        Dear Simon : Got it. Many thanks. Morris:) Morris Pan

        1 Reply Last reply
        0
        • S SJolly

          In the handler for the button press, put something along these lines: RECT stNewPosition; // setup the new position for the bitmap (this can also resize it) stNewPosition.top = 50; stNewPosition.left = 50; // etc... // this moves the bitmap only GetDlgItem(IDB_YOUR_BITMAP)->MoveWindow(&stNewPosition, TRUE); I think you can move the image off your dialog with this - effectively making it vanish so beware. Regards, Simon

          M Offline
          M Offline
          Morris_Pan
          wrote on last edited by
          #4

          Dear Friend: Thank you first. It comes another question for me. How come if I want to move Bitmap by implementing the DC ? Can you please show me the way? Thanks Morris:confused: Morris Pan

          S 1 Reply Last reply
          0
          • M Morris_Pan

            Dear Friend: Thank you first. It comes another question for me. How come if I want to move Bitmap by implementing the DC ? Can you please show me the way? Thanks Morris:confused: Morris Pan

            S Offline
            S Offline
            SJolly
            wrote on last edited by
            #5

            If by DC, you mean device context, I am sorry but I don't know as much about this as I always use move window. However, I know to get the device context you would do: CDC * pDeviceContext = NULL; pDeviceContext = GetDlgItem(IDC_YOUR_CONTROL)->GetDC(); Then you'll have to look in the MSDN for a CDC function that moves the image. Regards, Simon

            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