Author Topic: C++ Win32 - Using picturebox for painting program?  (Read 1740 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1418
  • Karma: 109
    • View Profile
Atm i am using DIB to handle and manipulate graphics/images in nearly realtime. For drawing and updating the image, i am using:

Code: [Select]
                hdc = BeginPaint(hWnd, &ps);
StretchDIBits(hdc, 1, 1, 1024, 480, 0, 0, 1024, 480, buffer, &bmi, DIB_RGB_COLORS, SRCCOPY);
EndPaint(hWnd, &ps);

Features i would like to add:  scrollbars/scrollarea, zoom in/out....

So whats the best way for a drawing program? Drawing image with StrechDIBIts directly to the window or scrollarea...
Or does it makes sense to use Win32 API picturebox for high flexibilty and even to have best performance/speed?
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: C++ Win32 - Using picturebox for painting program?
« Reply #1 on: August 03, 2015 »
For this application it probably doesn't make any difference if you use GDI or DirectX.  You're only doing one blit, so as long as there's no colour conversion or scaling going on (your source and dest DIB have the same size and bit-depth) then they probably end up going through the same underlying API anyway.

Challenge Trophies Won: