Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GdiPLusX Drawing on a form with scrollbars
Message
De
17/12/2007 09:19:05
 
 
À
17/12/2007 09:13:05
Information générale
Forum:
Visual FoxPro
Catégorie:
VFPX/Sedna
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Divers
Thread ID:
01276096
Message ID:
01276245
Vues:
36
Yes, that's exactly what I mean.

After you prepare your loBMP GDI+ object, you may draw directly on the surface using the HWND Graphics.


Something like this:
loGfx = .Graphics.FromHWND(Thisform.RealHWND) && The HWND we obtained here previously
loGfx.DrawImage(loBmp, 0, 0) && Change it to your desired coordinates.
This means that you'll create your bitmap first,and only whenfinished, it will be sent to the screen, CAPICHE ???

Some people also all this as a DoubleBuffering technique.

HTH

Cesar


>>Sergio,
>>
>>Drawing directly on the surface of the form will CERTAINLY improve your performance, but this technique is tricky also.
>>
>>The main problem is to take care of the form redrawings, when resizing, minimize/maximize, moving the form. Even changing the scrollbars may delete your drawings.
>>
>>
>>My other other recommendation is that you should first create an empty bitmap, and get the Graphics hadle from it. Use this Gfx object to do all your drawings. When finished, draw the whole created image in just one time in the Screen. This will make a big difference, and will also reduce some annoying flickering effects.
>
>Hi Cesar,
>
>Are you talking about direct surface drawing to be 'wrapped' this way
>or doing it in memory and then updating existing ImageCanvas at one go
>once all drawings are finished ?
>
>I would defenetely prefer to stay with ImageCanvas;
>Would this way speed up canvas drawing as well or this only applies on
>Surface Drawing ?
>
>If I understood properly then I should have something like;
>(Your old code sample)
>
>
>WITH _SCREEN.System.Drawing
>
>* Create a new Bitmap
>LOCAL loBmp as xfcBitmap
>loBmp = .Bitmap.New(1000,800)
>
>* Create a Graphics object associated to the bitmap
>LOCAL loGfx as xfcGraphics
>loGfx = .Graphics.FromImage(loBmp)
>
>* "Clears" the background of the image to Red
>loGfx.Clear(.Color.red)
>
>* Fills a Blue ellipse
>loGfx.FillEllipse(.Brushes.Blue, 20,20,110,110)
>
>*loGfx.FillRectangle(.Brushes.White, 20,20,110,110)
>
>loGfx.FillRectangle(.SolidBrush.New(.Color.FromRGB(255,255,0)) , 20,20,110,180)
>
>.
>......300 Strings
>.
>
>endwith
>
>
>
>So where/how do I show 'loBmp' from here ?
>
>TIA
>Sergio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform