Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Performance question on GDI+ classes
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01468355
Message ID:
01469096
Vues:
220
>I am currently trying out Bernard’s shiny glass VFP buttons which utilize these classes. The form that will contain these buttons will also contain a background picture under the buttons. If I render these buttons using the default render mode of zero (memory BMP), then the surrounding areas of the button which accommodate the shadow show up and cover the background image. So, I changed the surrounding colors to be .Color.Transparent and tried render modes of 4 and 5 (memory/file PNG). This got the transparency to work perfectly, however the performance of the buttons as they get rendered (i.e. a new Draw() during MouseEnter and MouseLeave) is extremely slow.
>
>Would anyone have any ideas as to how to get my performance back? The only thing I could think of right now is to save multiple PNGs to represent the button’s different states (default, hovered, and clicked) and just those for the events on a standard image control. However, I'd prefer just using the controls as designed with better performance.
>
>Any assistance would be greatly appreciated.

Hi Jon

You are right. With an image in the background, the shadows show up badly.

This is easily fixed by changing the code in the BeforeDraw() of the class in 2 places:
1) With _Screen.System.Drawing
	* clear
	loGfx.Clear(.Color.FromRGB(Thisform.backcolor))

change to 

        loGfx.Clear(.Color.Transparent) 


2) Similarly later on 

loBrush2.SurroundColors = .Color.FromRgb(Thisform.Backcolor)  && fade into background

change to 

loBrush2.SurroundColors = .Color.Transparent  && fade into background
This change along with setting the RenderMode = 4 will produce proper transparent shadows over a form with a background image.

Now regarding your 2nd problem - slowness of response.

I am using an older computer with only 1 gig of memory and a shabby graphics card, all at least 5 years old and on a form with 16 buttons and a background image, I do not see this sluggishness.

Anyway I will send you a test form with these 8 buttons. Just set the picture property of the form to your image and run the form. Hopefully your email as shown here is the same.

Also important - use the included GDIPLUS.VCX I send you, instead of the one you have. Do not forget this step.

Another thing - is the background image on your form a JPG, BMP or PNG? If the background image is a PNG, convert it to a BMP or JPG and test the response again.

And for Cesar, the buttons are not being drawn twice, but once each time.

Let me know how you go.

By the way there are some lightweight buttons here as well:

http://weblogs.foxite.com/bernardbout/archive/2010/04/06/10713.aspx

Bernard
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform