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. custom static control lin vc++

custom static control lin vc++

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicshelpquestion
3 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.
  • S Offline
    S Offline
    sanjay007
    wrote on last edited by
    #1

    i have a handle to a bitmap image using Loadimage(...,LR_FROMFILE).. how do i use it to display the image in a custom static control that i have created by subclassing the static control using bitblt() function.Also i need to use the scrollbars if the image size is greater thn the size of the control... can anyone help!! sanjay

    T 1 Reply Last reply
    0
    • S sanjay007

      i have a handle to a bitmap image using Loadimage(...,LR_FROMFILE).. how do i use it to display the image in a custom static control that i have created by subclassing the static control using bitblt() function.Also i need to use the scrollbars if the image size is greater thn the size of the control... can anyone help!! sanjay

      T Offline
      T Offline
      Tareq Ahmed Siraj
      wrote on last edited by
      #2

      For painting the bitmap into your static, use

      CPaintDC dc(this);
      CDC MemDc;
      CRect rcClient;
      GetClientRect(&rcClient);
      MemDc.CreateCompatibleDC(this->GetDC());
      CBitmap* pMemBitmap = MemDc.SelectObject(&m_Bitmap); //m_Bitmap is the handle to your bitmap
      if (pMemBitmap)
         dc.BitBlt(0, 0, rcClient.right, rcClient.bottom, &MemDc, 0, 0, SRCCOPY);
      MemDc.SelectObject(pMemBitmap);
      

      Sorry cant help you with the scrollbar thing... hope this helps. - tareq

      S 1 Reply Last reply
      0
      • T Tareq Ahmed Siraj

        For painting the bitmap into your static, use

        CPaintDC dc(this);
        CDC MemDc;
        CRect rcClient;
        GetClientRect(&rcClient);
        MemDc.CreateCompatibleDC(this->GetDC());
        CBitmap* pMemBitmap = MemDc.SelectObject(&m_Bitmap); //m_Bitmap is the handle to your bitmap
        if (pMemBitmap)
           dc.BitBlt(0, 0, rcClient.right, rcClient.bottom, &MemDc, 0, 0, SRCCOPY);
        MemDc.SelectObject(pMemBitmap);
        

        Sorry cant help you with the scrollbar thing... hope this helps. - tareq

        S Offline
        S Offline
        sanjay007
        wrote on last edited by
        #3

        thanks tareq, i will try this out at night on my pc.. sanjay

        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