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. Easy CImage Question?

Easy CImage Question?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++graphics
2 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.
  • D Offline
    D Offline
    Dave Kerr
    wrote on last edited by
    #1

    Hi All, I'm having real difficulty in getting transparency to work in my application. I am drawing an image into the window title bar, the code (in short) is below:

    void CThemedDialog::OnNcPaint()
    {
    // Get device context of the window.
    CDC* pWindowDC = GetWindowDC();

    //	Get rectangle of window.
    CRect rcWindow;
    GetWindowRect(rcWindow);
        ///..some basic drawing...
    
    m\_bitmapWindowIcon.Draw(pWindowDC->GetSafeHdc(), 5, 5);
        //even trying with the line below doesn't work!
    //m\_bitmapWindowIcon.AlphaBlend(pWindowDC->GetSafeHdc(), 5, 5);
    
    ReleaseDC(pWindowDC);
    

    m_bitmapWindowIcon is an ATL::CImage object that is loaded from a png file (I've also tried with a jpeg file). I never get any transparency - just white pixels where the transparent ones should be. Is there something stupid I am doing? I'm pulling my hair out over this! Thanks in advance, Dave

    A 1 Reply Last reply
    0
    • D Dave Kerr

      Hi All, I'm having real difficulty in getting transparency to work in my application. I am drawing an image into the window title bar, the code (in short) is below:

      void CThemedDialog::OnNcPaint()
      {
      // Get device context of the window.
      CDC* pWindowDC = GetWindowDC();

      //	Get rectangle of window.
      CRect rcWindow;
      GetWindowRect(rcWindow);
          ///..some basic drawing...
      
      m\_bitmapWindowIcon.Draw(pWindowDC->GetSafeHdc(), 5, 5);
          //even trying with the line below doesn't work!
      //m\_bitmapWindowIcon.AlphaBlend(pWindowDC->GetSafeHdc(), 5, 5);
      
      ReleaseDC(pWindowDC);
      

      m_bitmapWindowIcon is an ATL::CImage object that is loaded from a png file (I've also tried with a jpeg file). I never get any transparency - just white pixels where the transparent ones should be. Is there something stupid I am doing? I'm pulling my hair out over this! Thanks in advance, Dave

      A Offline
      A Offline
      Adam Roderick J
      wrote on last edited by
      #2

      Please clear you question :confused:

      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