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. "MS Paint-style" text input on CWnd

"MS Paint-style" text input on CWnd

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsc++winformstutorialquestion
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.
  • _ Offline
    _ Offline
    _NielsB
    wrote on last edited by
    #1

    I have to put some graphical functions to an dialog-based application using MFC/GDI/GDI+. One of them is to give the user the abbility to write text-comments on a image. Like you can do in MSPaint (and Photshop, GIMP ... ). I found thats relatively easy to parse the mouse - and keyboard input and simply write it to screen (using Graphics DrawString - Method), but it seems to be not trivial to enable editing of the written text (blinking cursor when double-clicking on the text ie). Or setting up a correct-sized (and blinking ;) ) cursor to signalize, that the app is ready to parse keyboard input. So, does someone got a idea how to implement MSPaint-like text input on CWnd? Searched for 2 days for demo-projects or smth like that, no success at all. Thanks in advance and sorry for my ******* english.

    H G 2 Replies Last reply
    0
    • _ _NielsB

      I have to put some graphical functions to an dialog-based application using MFC/GDI/GDI+. One of them is to give the user the abbility to write text-comments on a image. Like you can do in MSPaint (and Photshop, GIMP ... ). I found thats relatively easy to parse the mouse - and keyboard input and simply write it to screen (using Graphics DrawString - Method), but it seems to be not trivial to enable editing of the written text (blinking cursor when double-clicking on the text ie). Or setting up a correct-sized (and blinking ;) ) cursor to signalize, that the app is ready to parse keyboard input. So, does someone got a idea how to implement MSPaint-like text input on CWnd? Searched for 2 days for demo-projects or smth like that, no success at all. Thanks in advance and sorry for my ******* english.

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Hope I understood your question You draw a image on screen and now you want to write on the image and also you need to modify image. Maybe this way isnt good but its possible. You draw your image when you want to write a text on image use of a editbox for gets text and transfer your text when it finish to a external image if you need to modify this text again use of editbox for it. But maybe you ask I need to write this text on image and also location of text is important,not problem when you click mouse on screen create editbox on it location and set external image on this location when you want to close app or close image write these texts to Main Image. (You need to arrays for save these text or texts and also location of these texts)


      WhiteSky


      1 Reply Last reply
      0
      • _ _NielsB

        I have to put some graphical functions to an dialog-based application using MFC/GDI/GDI+. One of them is to give the user the abbility to write text-comments on a image. Like you can do in MSPaint (and Photshop, GIMP ... ). I found thats relatively easy to parse the mouse - and keyboard input and simply write it to screen (using Graphics DrawString - Method), but it seems to be not trivial to enable editing of the written text (blinking cursor when double-clicking on the text ie). Or setting up a correct-sized (and blinking ;) ) cursor to signalize, that the app is ready to parse keyboard input. So, does someone got a idea how to implement MSPaint-like text input on CWnd? Searched for 2 days for demo-projects or smth like that, no success at all. Thanks in advance and sorry for my ******* english.

        G Offline
        G Offline
        Galatei
        wrote on last edited by
        #3

        Hi, In order to get movable and resizable edit control for placing texts on an image, just search CodeProject website for articles explaining "double subclassing". Regards

        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