one of the things i wanted was to be able to drop an image object on my form, set its picture property to an image and have the image "reflection" visible, which gives a very good effect.

well now that we have the gdi+x classes that is no longer a wish, but a fact.

this implementation requires the gdi+x classes available from the vfpx site.go get them.

basically the imagecanvas is used, its picture property is set to your picture and the height of the reflection in pixels is set. that is all. note that you can also use the stretch and anchor properties.

also note that you need to allow space at the bottom of the image for the reflection, depending on the value you set in the "nreflectivity" property of the class. this is the height of the reflection you require, in pixels.

basically the class resizes itself to accomodate the reflection, draws the original picture, flips and redraws the picture, then applies a transparent gradient to the bottom part to give the fading effect.

in the sample form attached i have added a number of reflection objects with different nreflectivity values to show the effect. also the class can be dropped into a container as i have also done. however you cannot use these on any form with a picture as its background.

the form along with the class can be downloaded from the link below.

on running the sample form, the class does its magic as you can see below.

now lets reflect on that.

unfortunately because of the amount of junk mail being generated from the weblog i have switched off comments. please post your comments, if any, at www.foxite.com

9 Responses to Lets Reflect a bit on GDI+

  • Norman says:

    Hi Bernard.
    Thanks for supporting us.
    I want your help. I have just created ribbonbar looks like office 2007 using graphics.  But i can’t give it all functionality like group over effect, resize effect, tooltips with shadow. Is it available anxware? If not plz give me suggession.

    Hi Norman

    Please post such off-topic queries on the foxite website. Not a member? It’s free to become a member at http://www.foxite.com.

    Ribbonbar – Such a control already exists on VFPX called TABMENU.

  • christ says:

    it doesnt work on me, the image doesnt show up

    Anyone else have this problem?

  • Bernard:

    You are doing great things with gdiplusx. Thanks for sharing, and keep them coming!

    Thanks Carlos. More on the way.

  • Drop dead gorgeous work, Bernard!!!!!

    Thanks Kenneth

  • Erik Gomez says:

    does not seem to work for me i have the latest GDI+ from VFPx but the images does not showup

    You need the version 1.10 not the Beta 1.20. So what exactly shows up instead of the images? Also if you want a reply leave your email.

  • Erik Gomez says:

    you know the funny thing is, i used the beta 1.20 (01 Oct 2008)and it worked. thanks for replying. great work by the way. my email address is eaglegreek[at]gmail[dot]com

    You need to upgrade to VFP9Sp2. There is no support for loading PNG’s using the PictureVal property in VFP9Sp1 and the GDIPLUS classes uses that.

  • sesa says:

    the image doesn’t show up. I try bbbetterimageclass and got a same problem.

    You need to upgrade to VFP9Sp2. There is no support for loading PNG’s
    using the PictureVal property in VFP9Sp1 and the GDIPLUS classes uses
    that
    .

  • hilaly hassan says:

    salut bernad

    Reflected image don’t works perfectly when used with gradient backgroud form.

    • Bernard Bout says:

      What are you using for the form gradient background? An image or what? That should not make any difference.

Leave a Reply

Your email address will not be published. Required fields are marked *