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. Writing text on given bitmap file

Writing text on given bitmap file

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

    How do i write text on a bitmap file where only the path of the bitmap file is given?

    C H 2 Replies Last reply
    0
    • K KongHL

      How do i write text on a bitmap file where only the path of the bitmap file is given?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If it's a bmp, LoadImage will load it. Otherwise, GDI+ will probably load it. Then you need to select it into a DC, draw text on it and save it again ( which probably means you need GDI+ and will load it into a Graphics object ). I have several articles on gDI+ here, one of them is called 'doodle' - it will show you how to load and save an image, and draw on it. Just change the code to draw text instead. Christian Graus - Microsoft MVP - C++

      K 1 Reply Last reply
      0
      • C Christian Graus

        If it's a bmp, LoadImage will load it. Otherwise, GDI+ will probably load it. Then you need to select it into a DC, draw text on it and save it again ( which probably means you need GDI+ and will load it into a Graphics object ). I have several articles on gDI+ here, one of them is called 'doodle' - it will show you how to load and save an image, and draw on it. Just change the code to draw text instead. Christian Graus - Microsoft MVP - C++

        K Offline
        K Offline
        KongHL
        wrote on last edited by
        #3

        I cant find the the article... would u mind giving me the link? Its a bmp but not not necessarily in the resource folder...

        C 1 Reply Last reply
        0
        • K KongHL

          I cant find the the article... would u mind giving me the link? Its a bmp but not not necessarily in the resource folder...

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          I don't see how you could miss it. I typed 'doodle' in to the search and it was the first hit. You could also click on my name and 'view articles'. http://www.codeproject.com/vcpp/gdiplus/doodle.asp[^] The bmp would have to be on disc, not a resource. Christian Graus - Microsoft MVP - C++

          1 Reply Last reply
          0
          • K KongHL

            How do i write text on a bitmap file where only the path of the bitmap file is given?

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

            CImage m_Image; m_Image.Load("d:\\picture.bmp"); in the function OnPaint(event WM_PAINT) CPaintDC dc(this); // device context for painting BitBlt(dc.m_hDC,0,0,800,600,hdc,0,0,SRCCOPY); dc.TextOut(40,40,"test",5);

            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