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 undo drawing images in MFC.?

How to undo drawing images in MFC.?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsc++helptutorialquestion
5 Posts 4 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
    mbatra31
    wrote on last edited by
    #1

    Hi, I want to provide undo/redo drawing feature in MFC dialog based application. I am saving the images dynamically in a vector in OnMouseMove handler code. But when I am going to load the previous image on clicking Undo button, its getting distorted. the last image saved still remains there on the canvas. Can anybody tell me whats the issue with OnMouseMove handler. How the compiler will know when to end saving the image.? Regards,

    L M S 3 Replies Last reply
    0
    • M mbatra31

      Hi, I want to provide undo/redo drawing feature in MFC dialog based application. I am saving the images dynamically in a vector in OnMouseMove handler code. But when I am going to load the previous image on clicking Undo button, its getting distorted. the last image saved still remains there on the canvas. Can anybody tell me whats the issue with OnMouseMove handler. How the compiler will know when to end saving the image.? Regards,

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      mbatra31 wrote:

      How the compiler will know when to end saving the image.?

      The compiler knows nothing, it's your code that has to do the work. Without seeing some of your code it's impossible to know what is going on.

      speaking as ...

      1 Reply Last reply
      0
      • M mbatra31

        Hi, I want to provide undo/redo drawing feature in MFC dialog based application. I am saving the images dynamically in a vector in OnMouseMove handler code. But when I am going to load the previous image on clicking Undo button, its getting distorted. the last image saved still remains there on the canvas. Can anybody tell me whats the issue with OnMouseMove handler. How the compiler will know when to end saving the image.? Regards,

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

        Don't save the image the "OnMouseMove" event handler, save it in the OnLButtonUp handler (normally when the action is finished); or else you will end up with thousands and thousands of images. How are you saving and putting back the image ? BitBlt ? StretchBlt ? show us some code. If the image is stretched, are you certain you are using the good Width and Height for the bitmap ?

        Watched code never compiles.

        M 1 Reply Last reply
        0
        • M Maximilien

          Don't save the image the "OnMouseMove" event handler, save it in the OnLButtonUp handler (normally when the action is finished); or else you will end up with thousands and thousands of images. How are you saving and putting back the image ? BitBlt ? StretchBlt ? show us some code. If the image is stretched, are you certain you are using the good Width and Height for the bitmap ?

          Watched code never compiles.

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

          Hi Maximilien, Thanx for your response. I have done that part. I am saving the images in OnLButtonUp event handler only. Thanx & Regards,

          1 Reply Last reply
          0
          • M mbatra31

            Hi, I want to provide undo/redo drawing feature in MFC dialog based application. I am saving the images dynamically in a vector in OnMouseMove handler code. But when I am going to load the previous image on clicking Undo button, its getting distorted. the last image saved still remains there on the canvas. Can anybody tell me whats the issue with OnMouseMove handler. How the compiler will know when to end saving the image.? Regards,

            S Offline
            S Offline
            Sunil P V
            wrote on last edited by
            #5

            Check this link http://www.codeproject.com/Messages/4305065/Re-How-to-Undo-Redo-drawing-operation-in-a-dialog-.aspx[^]

            Sunil

            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