Fabien, right on the button. Cached now seems to work for me - when the code was first written in G2 some years ago, minimising the window blanked the DrawingArea to background and overlaying it with a window from another application blanked the hidden part of the DrawingArea (I can't now remember if this always happened or if it was intermittent, depending on some factor which I never identified). Turning on cached did not help. Hence the workaround of the use of an invisible PictureBox to backup the image, allowing its restoration to be a neat single operation independent of the original drawing process.
So I'm happy. What was for you, no doubt, a simple observation has saved me a lot of hassle. Thank you. Richard On 09/11/16 17:53, Fabien Bodard wrote: > 2016-11-09 17:45 GMT+01:00 Richard Welch <richardpa...@gmail.com>: >> Fabien, thank you for your reply. >> >> There are snags with each of these... >> >> First approach: >> >> Although the DrawingArea is often fully visible on screen, sometimes it >> will be too big. >> I can think of a way round this but it is not very elegant! >> >> Second approach: >> >> The image is sometimes highly complex and can comprise hundreds of >> rectangles and lines as well as text. I already do use generic >> functions as you describe, with variable-driven adjustments to cope with >> the differences between printing and screen display. There are many >> places in the code which may build a display. >> >> I found in G2 that there were times when the image in a DrawingArea was >> not restored if it was partially covered by a window from another >> application and then exposed once more. This mechanism enabled it to be >> restored easily without having to rebuild it from scratch. Maybe the >> DrawingArea in G3 is more robust? > And why not using cached mode ? >> Richard >> >> >> On 08/11/16 17:31, Fabien Bodard wrote: >>> Well... there is two answers. >>> >>> First : >>> >>> Use the Desktop.ScreenShot Function >>> (http://gambaswiki.org/wiki/comp/gb.qt4/desktop/screenshot). >>> But your widget must be visible on the screen... This is why it is a >>> SCREEN shot. >>> >>> >>> Second : >>> >>> When you are drawing something in a drawingarea you use a generic >>> drawing function. >>> >>> Exemple : >>> >>> >>> Public sub DrawingArea_Draw() >>> >>> DrawARect() >>> >>> End >>> >>> >>> Private Sub DrawARect() >>> >>> Paint.Brush = Brush.Color(Color.Yellow) >>> Paint.Rectangle(10,10,Paint.Width - 20, Paint.Height - 20) >>> Paint.Fill >>> >>> End >>> >>> >>> Public Function MakeImage(iWidth as integer, iHeight as integer) as Image >>> >>> Dim hImage a new Image(iWidth, iHeight, Color.White) >>> >>> Paint.Begin(hImage) >>> DrawARect() >>> Paint.End >>> >>> End >>> >>> >>> With that you have only one drawing function (DrawARect) able to draw >>> every where ... even on a printer. This is the way used in most of the >>> components too >>> >>> 2016-11-08 12:52 GMT+01:00 Richard Welch <richardpa...@gmail.com>: >>>> I need a simple way to copy the current image in a visible DrawingArea >>>> to a hidden PictureBox. >>>> >>>> The project was written in Gambas2, where a simple Grab method did the >>>> trick, but in G3 this does something different so the converted code >>>> does not function fully. >>>> >>>> FMain.pbxPicture.W = FMain.drwRep.W >>>> FMain.pbxPicture.H = FMain.drwRep.H >>>> FMain.pbxPicture.Background = FMain.drwRep.Background >>>> FMain.pbxPicture.Picture = FMain.drwRep.Grab() >>>> >>>> With what do I replace the Grab method? >>>> >>>> (The DrawingArea is painted in many different pieces of code, depending >>>> on context, so I want to make the change which will have the smallest >>>> impact possible on the source code) >>>> >>>> There is a gambas-user thread started around 19 April 2012. >>>> Is this fully relevant? >>>> Is this the /simplest/ answer? >>>> It would need some very tedious testing in my context..... >>>> >>>> ------------------------------------------------------------------------------ >>>> Developer Access Program for Intel Xeon Phi Processors >>>> Access to Intel Xeon Phi processor-based developer platforms. >>>> With one year of Intel Parallel Studio XE. >>>> Training and support from Colfax. >>>> Order your platform today. http://sdm.link/xeonphi >>>> _______________________________________________ >>>> Gambas-user mailing list >>>> Gambas-user@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/gambas-user >>> >> >> ------------------------------------------------------------------------------ >> Developer Access Program for Intel Xeon Phi Processors >> Access to Intel Xeon Phi processor-based developer platforms. >> With one year of Intel Parallel Studio XE. >> Training and support from Colfax. >> Order your platform today. http://sdm.link/xeonphi >> _______________________________________________ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user > > ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user