saving scroll window as picture Topic is solved

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
ding
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Jan 04, 2006 7:55 am
Location: Singapore

saving scroll window as picture

Post by ding » Mon Mar 06, 2006 7:38 am

How do i save a scroll window that were being drawn as picture?
Can anyone give me a link or sample source code to figure it out ?

tbreina
Moderator
Moderator
Posts: 1289
Joined: Thu Nov 25, 2004 7:38 pm
Location: Coronado, CA

Post by tbreina » Mon Mar 06, 2006 8:58 am

Why not just press SHIFT+Prt Sc (Print Screen)? It will copy the current screen to the clipboard and you can paste it into Windows Paint.

-Tony
Everybody's got something to hide except for me and my monkey.

ding
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Jan 04, 2006 7:55 am
Location: Singapore

Post by ding » Mon Mar 06, 2006 9:15 am

Yeah, that is possible! A way to do it, but that not what i looking for.I don think there is a need to press shift
Last edited by ding on Mon Mar 06, 2006 9:17 am, edited 2 times in total.

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Mon Mar 06, 2006 9:15 am

In general you'll need the following to take a screen shot:
- wxBitmap for holding the screenshot
- wxMemoryDC for "drawing" to the screenshot image
- One of the wxDC classes to take the screenshot

Create the wxMemoryDC and wxBitmap. Be sure that the bitmap has width and height big enough to store the window image. Assign the bitmap to othe memory dc by using SelectObject(). All drawing actions on th mem dc will now go to the bitmap.
Create a dc for the window you want a screenshot for. Then use Blit to take the screen shot, like

Code: Select all

memDC.Blit(0,0,windowWidth, windowHeight,&windowDC,0,0);
Afterwards use SelectObject(NULL); and save the bitmap.
Last edited by upCASE on Mon Mar 06, 2006 9:19 am, edited 1 time in total.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

ding
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Jan 04, 2006 7:55 am
Location: Singapore

Post by ding » Mon Mar 06, 2006 9:18 am

Thanks for the help!

ding
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Jan 04, 2006 7:55 am
Location: Singapore

Post by ding » Tue Mar 07, 2006 3:07 am

Thanks upcase! To take a ss,

memdc.Blit(0,0, window width,window height, &dc,x-coordinate(start),y-coordinate(start),wxCOPY);

Post Reply