Displaying plots MFC C++
Posted: Tue Apr 26, 2011 6:12 pm
I want to display a plot, but when i try to display my picture box (CStatic derived control) Diplot shows first and i have a white bitmap on my picture box. I have implemented ONPaint () on the picture box (it was grey at the beginning and it turns white..) . Does anyone have an idea how to display the actual plot On my picture box ? I do not want a diplot window to pop up.
Code: Select all
void MyPictureCtrl::OnPaint()
{
HBITMAP bm=this->GetBitmap();
if(bm !=0)
{
CPaintDC dc(this);
// device context for painting
HDC dcmem=::CreateCompatibleDC(dc);
if (dcmem!=0)
{
CBitmap* old = dc.SelectObject((CBitmap*)bm);
//500,500 just to try
::BitBlt(dc,rect_->left,rect_->top,500,500,dcmem,0,0,SRCCOPY);
::SelectObject(dcmem, old);
::DeleteObject(dcmem);
}
::ReleaseDC(this->m_hWnd,dc);
}
}