Displaying plots MFC C++

Q&A for C, C++, and/or C# developers using DPlot

Moderator: DPlotAdmin

Post Reply
Sadbrute
Posts: 14
Joined: Tue Apr 26, 2011 6:06 pm

Displaying plots MFC C++

Post by Sadbrute »

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);
		}
	}
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

I don't see anything that should prevent the bitmap from being displayed, though I'll look into it more.

As far as DPlot being visible, start it before creating a plot with
DPlot_Start(1,(int *)NULL);
Visualize Your Data
support@dplot.com
Post Reply