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

C / C++ / MFC

 
GeneralRe: Visual Basic sendmessage Pin
soul.ripper29-May-04 7:29
soul.ripper29-May-04 7:29 
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 
I try to reproduce your program. In MFC SDI application I added to following code to view OnDraw function:

void CGDITestView::OnDraw(CDC* pDC)
{
CGDITestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;

CRect rect;
GetClientRect(&rect);
int nWidth = rect.right - rect.left +1;
int nHeight = rect.bottom - rect.top + 1;

CClientDC ClientDC(this);
// Graphics graphics(ClientDC.m_hDC); // GDI+ Stuff graph(ClientDC.m_hDC);
Graphics graphics(pDC->m_hDC); // GDI+ Stuff graph(ClientDC.m_hDC);

// Test for drawing with double buffering
// Bitmap* bmp = new Bitmap(nWidth,nHeight); and
// Bitmap* bmp(nWidth,nHeight); seems to give the same results...
#ifdef _DEBUG
#undef new
Bitmap* bmp = new Bitmap(nWidth,nHeight);
#define new DEBUG_NEW
#else
Bitmap* bmp = new Bitmap(nWidth,nHeight);
#endif
Graphics* graph = Graphics::FromImage(bmp);

CRect area( 0, 0, 0, 0);

// This works, no questions asked, but it's not double buffering
//area.SetRect( 8, 90, 814, 90); // Skillelinje som skiller elevdata fra resten av skjemaet
//DrawLine(&graphics, area, 1);

/* Test drawing to test double buffering */
// Takes about 10 seconds without double buffering
// Takes about xx seconds with double buffering
Pen pen(Color(200,0,0, 50));
for( int j=100; j<500;j = j + 5) {
for (int i=100; i<500; i = i + 5) {
area.SetRect( 110,110, j, i);

// This works.
//DrawLine(&graphics, area, 1);

// This line causes the crach, when commented out, the code does what it's supposed to do
graph->DrawLine(&pen, area.left, area.top, area.Width(), area.Height());
}
}

graphics.DrawImage( bmp, 0,0, 600, 600);
delete graph;
delete bmp;
/* End test drawing */
}

It works. From your post it is difficult to understand what happens. Please remove all lines which are not related to your problem, and post the whole function (including header).

>> I get the "standard" windows dialog, which asks if I want to send an error report.

To get more information run program in Debug congiguration, and use Go command instead of Run. In this case program breaks in Debugger and you can see what exactly happens.
GeneralRe: Double buffering with GDI+ Pin
Jorgen E.25-May-04 3:30
Jorgen E.25-May-04 3:30 
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 

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.