Click here to Skip to main content
15,907,906 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual Basic sendmessage Pin
David Crow31-May-04 9:22
David Crow31-May-04 9:22 
GeneralactiveX control - using CListCtrl Pin
BlackDice24-May-04 10:44
BlackDice24-May-04 10:44 
GeneralRe: activeX control - using CListCtrl Pin
Dimitris Vasiliadis24-May-04 12:05
Dimitris Vasiliadis24-May-04 12:05 
GeneralRe: activeX control - using CListCtrl Pin
BlackDice25-May-04 6:00
BlackDice25-May-04 6:00 
GeneralGetSaveFileNamePreview Pin
Andy Moore24-May-04 9:44
Andy Moore24-May-04 9:44 
GeneralDouble buffering with GDI+ Pin
Jorgen E.24-May-04 8:49
Jorgen E.24-May-04 8:49 
GeneralRe: Double buffering with GDI+ Pin
567890123424-May-04 19:28
567890123424-May-04 19:28 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 3:30
Jorgen E.25-May-04 3:30 
<br />
void CITPAXpertView::OnDraw(CDC* /*pDC*/)<br />
{<br />
	CITPAXpertDoc* pDoc = GetDocument();<br />
	ASSERT_VALID(pDoc);<br />
	if (!pDoc)<br />
		return;<br />
<br />
	// Kode for å tegne opp rapporten<br />
<br />
	// Beregner området å tegne i<br />
	CRect rect;<br />
	GetClientRect(&rect);<br />
	int nWidth = rect.right - rect.left +1;<br />
	int nHeight = rect.bottom - rect.top + 1;<br />
<br />
	CClientDC ClientDC(this);<br />
	Graphics graphics(ClientDC.m_hDC);	// GDI+ Stuff graph(ClientDC.m_hDC);<br />
<br />
	#ifdef _DEBUG<br />
	#undef new<br />
		Bitmap* bmp = new Bitmap(nWidth,nHeight);<br />
	#define new DEBUG_NEW<br />
	#else<br />
		Bitmap* bmp = new Bitmap(nWidth,nHeight);<br />
	#endif<br />
		Graphics* graph = Graphics::FromImage(bmp);<br />
	<br />
	CRect area( 0, 0, 0, 0);<br />
<br />
	/*       Test drawing to test double buffering */<br />
	Pen pen(Color(200,0,0, 50));<br />
	for( int j=100; j<500;j = j + 5) {<br />
		for (int i=100; i<500; i = i + 5) {<br />
			area.SetRect( 110,110, j, i);<br />
// Using the next line, by removing the // will work fine, only to slow for my needs<br />
		//	graphics.DrawLine(&pen, area.left, area.top, area.Width(), area.Height());<br />
// Using the next line, by removing the // will CRACH to program<br />
			//graph->DrawLine(&pen, area.left, area.top, area.Width(), area.Height());<br />
		}<br />
	}<br />
	graphics.DrawImage( bmp, 0,0, 600, 600);<br />
	delete graph;<br />
	delete bmp;<br />
	/*       End test drawing       */<br />
}<br />


This is the function in question. As you can see, I've commented out both lines that draw in the view. If I use the first line, things work fine. If I use the second line, I get in trouble D'Oh! | :doh:

The rest of the class is basically a standard CView class, except that I've made a few changes to change it to CScrollView. Things seem to be working fine, so I assume that I haven't missed anything, and the class is in fact a CScrollView class, but I might be wrong?

As in your test, the application is SDI.

Thanks, I really appreciate your efforts.
GeneralRe: Double buffering with GDI+ Pin
567890123425-May-04 4:06
567890123425-May-04 4:06 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 4:45
Jorgen E.25-May-04 4:45 
GeneralRe: Double buffering with GDI+ Pin
567890123425-May-04 5:05
567890123425-May-04 5:05 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 5:12
Jorgen E.25-May-04 5:12 
GeneralRe: Double buffering with GDI+ Pin
567890123425-May-04 5:17
567890123425-May-04 5:17 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 5:22
Jorgen E.25-May-04 5:22 
GeneralRe: Double buffering with GDI+ Pin
567890123425-May-04 5:43
567890123425-May-04 5:43 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 6:01
Jorgen E.25-May-04 6:01 
GeneralRe: Double buffering with GDI+ Pin
567890123425-May-04 6:46
567890123425-May-04 6:46 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 6:55
Jorgen E.25-May-04 6:55 
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.23-Jun-04 8:21
Jorgen E.23-Jun-04 8:21 
QuestionHibernate event on WinXP ? Pin
Cris24-May-04 8:36
Cris24-May-04 8:36 
AnswerRe: Hibernate event on WinXP ? Pin
Graham Bradshaw24-May-04 13:37
Graham Bradshaw24-May-04 13:37 
GeneralReading .PSD file Pin
nachilau24-May-04 8:27
nachilau24-May-04 8:27 
GeneralRe: Reading .PSD file Pin
David Crow24-May-04 8:31
David Crow24-May-04 8:31 
Generalmenu next to images Pin
Member 466743724-May-04 6:54
Member 466743724-May-04 6:54 
GeneralGetMessage Hook and App Crashing Pin
User 1278224-May-04 6:50
User 1278224-May-04 6:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.