Has anyone had any experience copying the wxClientDC of a wxFrame (or
wxPanel for that matter) into a wxMemoryDC?
I'm trying to add a "screen print"-like capability to my program, and it
mostly works. However, the copied bitmap doesn't show a "refreshed"
wxFrame. In other words, if a menu or dialog is covering up part of the
wxFrame when I perform the wxDC.Blit, then junk appears in that
part of the resultant bitmap.
This is under wxGTK 2.4, running under KDE 3.1.2.
My code fragment:
# Note: "window" has been both a wxFrame and a wxPanel -- same
results.)
src = wxClientDC(window)
w, h = window.GetClientSizeTuple()
bmp = wxEmptyBitmap(w, h)
dest = wxMemoryDC()
dest.SelectObject(bmp)
dest.Blit(0,0, w, h, src, 0, 0)
This code is executed when the user selects File | Print Screen... (to
give the context.)
On Tue, 20 May 2003 09:35:16 +0200 Rob van Putten <r.vanputten@hexapole.com> wrote:
Hi there,
I want to write a programme where the user can click
on a window to add points / draw lines etc. etc.
Does anyone have / know some sample code / project for this kind of
task?
Thanks in advance,
Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwindows.org
Has anyone had any experience copying the wxClientDC of a wxFrame (or
wxPanel for that matter) into a wxMemoryDC?
I'm trying to add a "screen print"-like capability to my program, and it
mostly works. However, the copied bitmap doesn't show a "refreshed"
wxFrame. In other words, if a menu or dialog is covering up part of the
wxFrame when I perform the wxDC.Blit, then junk appears in that
part of the resultant bitmap.
When the menu event is sent the menu is still obscuring part of the frame's contents, and so the dc's contents are invalidated. You probably need to move your capture code to another method and then use wxCallAfter to invoke it later after the next paint event so the window can be refreshed.
BTW, this will only capture the contents of the window, not any child controls or windows that may be positioned over it. If you need to do that then try using a wxWindowDC.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!