Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2012  |  syntax: None  |  size: 1.06 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. GDI  problems on windows XP
  2. PAINTSTRUCT ps;
  3. HDC         hdc = BeginPaint( hwnd, &ps );
  4. Graphics    *graphics= new Graphics( hdc );
  5.  
  6. if ( graphics->Clear( BACKGROUND_COLOR ) != Ok )
  7. {
  8.     LOGGER << "LoginWindow::Error clearing surface" << endl;
  9.     goto clean;
  10. }
  11.  
  12. if ( graphics->DrawImage( dialogHeader, 0, 0, dialogHeaderSize.cx, dialogHeaderSize.cy ) != Ok )
  13. {
  14.     LOGGER << "LoginWindow::Error drawing image" << endl;
  15.     goto clean;
  16. }
  17.  
  18. if ( graphics->DrawRectangle( dialogBorderPen, 0, 0, LOGIN_WINDOW_WIDTH - 1, LOGIN_WINDOW_HEIGHT - 1 ) != Ok )
  19. {
  20.     LOGGER << "LoginWindow::Error drawing rectangle" << endl;
  21.     goto clean;
  22. }
  23.  
  24. clean:
  25. delete graphics;
  26. EndPaint( hwnd, &ps );
  27.        
  28. dialogHeader = Bitmap::FromFile( imagePath );
  29.        
  30. GdiplusStartupInput gdiplusStartupInput;
  31. Status              gdiplusStatus;
  32. ULONG_PTR           gdiplusToken;
  33.  
  34. gdiplusStatus = GdiplusStartup( &gdiplusToken, &gdiplusStartupInput, NULL );
  35.  
  36. if ( gdiplusStatus != Ok )
  37. {
  38.     LOGGER << "Main::Failed to initialize GDI+. ErrorCode=" << gdiplusStatus << endl;
  39.     return 1;
  40. }
  41.        
  42. Graphics graphics (m_hDC);