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. DrawState (CDC) problem

DrawState (CDC) problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 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.
  • Y Offline
    Y Offline
    YaronNir
    wrote on last edited by
    #1

    Hello, how can i draw an image that would be transparent? which means will get the background of where it is drawn.... this is the code i use to draw the image:

    HBITMAP hBmp = pDlgInf->GetBmp();
    CPoint pnt(rc.left + SPACE_WIDTH / 5,rcText.top);
    CSize size(IMAGE_DIMENTIONS,IMAGE_DIMENTIONS);
    pDC->DrawState(pnt,size,hBmp,DST_BITMAP);

    i see the image fine, but it is not transparent...the transparent color (0,128,128) is shown there... can any1 help? thanks in advanced Yaron Ask not what your application can do for you, Ask what you can do for your application

    Y 1 Reply Last reply
    0
    • Y YaronNir

      Hello, how can i draw an image that would be transparent? which means will get the background of where it is drawn.... this is the code i use to draw the image:

      HBITMAP hBmp = pDlgInf->GetBmp();
      CPoint pnt(rc.left + SPACE_WIDTH / 5,rcText.top);
      CSize size(IMAGE_DIMENTIONS,IMAGE_DIMENTIONS);
      pDC->DrawState(pnt,size,hBmp,DST_BITMAP);

      i see the image fine, but it is not transparent...the transparent color (0,128,128) is shown there... can any1 help? thanks in advanced Yaron Ask not what your application can do for you, Ask what you can do for your application

      Y Offline
      Y Offline
      YoSilver
      wrote on last edited by
      #2

      DrawState can draw transparent icons only. To draw a transparent bitmap, use the ::TransparentBlt function.

      Y 1 Reply Last reply
      0
      • Y YoSilver

        DrawState can draw transparent icons only. To draw a transparent bitmap, use the ::TransparentBlt function.

        Y Offline
        Y Offline
        YaronNir
        wrote on last edited by
        #3

        Thanks for the reply, i tried to use TransparentBlt, and i saw the image as transparent, but i got an other problem , if i moved the dialog outside the screen boundaries and then drag it back in, the image was fundged....it didn't appear well. can u help? thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application

        Y 1 Reply Last reply
        0
        • Y YaronNir

          Thanks for the reply, i tried to use TransparentBlt, and i saw the image as transparent, but i got an other problem , if i moved the dialog outside the screen boundaries and then drag it back in, the image was fundged....it didn't appear well. can u help? thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application

          Y Offline
          Y Offline
          YoSilver
          wrote on last edited by
          #4

          Well... all I think is that you should redraw your bitmap properly, that is, first clear the background and then blitting an image. Use clipping information in PAINTSTRUCT for proper paiting. And try to use double buffering.

          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