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. Clear Text Into BMP

Clear Text Into BMP

Scheduled Pinned Locked Moved C / C++ / MFC
json
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.
  • A Offline
    A Offline
    Aabid
    wrote on last edited by
    #1

    Hello I use Drawtext() API to Write The text into the BMP Picture..... Now I want To know Is There Any API To clear That Text Into The BMP.... Please Suggest.... ///CODE TO Draw Text GetClientRect(GetDlgItem(ts.hWnd, IDC_STATIC_BMP1), &r); hdc = GetDC(GetDlgItem(ts.hWnd, IDC_STATIC_BMP1)); SetBkMode(hdc ,TRANSPARENT); SetTextColor(hdc , RGB(0,0,0)); DrawText(hdc , szTempBuffer, -1, &r , DT_SINGLELINE | DT_CENTER | DT_VCENTER);

    N O 2 Replies Last reply
    0
    • A Aabid

      Hello I use Drawtext() API to Write The text into the BMP Picture..... Now I want To know Is There Any API To clear That Text Into The BMP.... Please Suggest.... ///CODE TO Draw Text GetClientRect(GetDlgItem(ts.hWnd, IDC_STATIC_BMP1), &r); hdc = GetDC(GetDlgItem(ts.hWnd, IDC_STATIC_BMP1)); SetBkMode(hdc ,TRANSPARENT); SetTextColor(hdc , RGB(0,0,0)); DrawText(hdc , szTempBuffer, -1, &r , DT_SINGLELINE | DT_CENTER | DT_VCENTER);

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      Aabid wrote:

      Now I want To know Is There Any API To clear That Text Into The BMP....

      There is nothing like an API for this, you've got to devise logic for this purpose, probably invalidate that region where the text is printed. Or probably set the text color (Dc.SetTextColor()) to background color and then print the text again. Don't forget to test this well cause there may be cases where the edges of text are still visible. Some other options that came to my mind is to use FillSolidRect/FillRect with background colors, but then there will be problems when you have gradient backgrounds.

      Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

      modified on Tuesday, August 26, 2008 6:54 AM

      1 Reply Last reply
      0
      • A Aabid

        Hello I use Drawtext() API to Write The text into the BMP Picture..... Now I want To know Is There Any API To clear That Text Into The BMP.... Please Suggest.... ///CODE TO Draw Text GetClientRect(GetDlgItem(ts.hWnd, IDC_STATIC_BMP1), &r); hdc = GetDC(GetDlgItem(ts.hWnd, IDC_STATIC_BMP1)); SetBkMode(hdc ,TRANSPARENT); SetTextColor(hdc , RGB(0,0,0)); DrawText(hdc , szTempBuffer, -1, &r , DT_SINGLELINE | DT_CENTER | DT_VCENTER);

        O Offline
        O Offline
        oobimoo
        wrote on last edited by
        #3

        What are you trying to do? (probably double buffering is the answer to your problem)

        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