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