class uppdated with builder preview 30/09/2008

the class in the attached zip, is an example of what you can do to spruce up your application. it contains an aquabutton class which uses the imgcanvas object from the gdi+x classes on codeplex.

this class is very easy to use especially since i have added in a builder. it is just a matter of dropping an instance of the class on a form, setting the properties manually or using the provided builder and bob's your uncle.

the class needs just a few properties as shown here. all properties that can be changed are in the "favourites" tab.

  1. bcaption - the caption to be displayed on the button
  2. buttonfont - the font to be used for the button text
  3. buttoncolour - the argb colour to be used for the button. better to use the builder for this.
  4. buttonfontcolour - the colour of the button text. see the point above.
  5. buttonfontsize - size of the button text font.

the item aquabuilderx is the builder used for setting all these properties in one shot.. when you select it, a button appears which if clicked, will display the custom builder, included in the class.

set the properties of the selected aquabutton using the builder. click apply to apply these changes and update the preview.

and run the form. the gdi+x classe does its magic and produces this clickable button with an aqua look, for the properties set as above. notice the shadow as well?

the button has a "hover" effect and changes colour when the mouse is over it.

as well, it has some animation so that you can get feedback when it is clicked.

here are some other samples i did earlier. as you can see you can have then any size or shape as long as they are rectangular.big smile [:d] the sample shows the buttons on a form as well as in a container.

cesar, bo and craig have done a fantastic job in translating the .net classes into a vfp class that is very easy to use. there are heaps of samples all over the internet and since these classes emulate the .net classes, any c# or vb code can easily be translated into vfp.

with a little imagination, this class can be used to enhance your gui as well as provide a number of enhancements to your class library arsenal. over the next few months i will be adding to the series of posts by cesar, on this class, with a number of posts my own, showing some practical examples of usage. hopefully it will encourage others to start using these classes and benefit from them.

also i want to say that i have been looking at these classes for a few weeks only and the support i received from cesar and bo, for my various queries, was really out of this world. thanks guys.

note:

as mentioned in other posts,

i dont include the gdiplusc.vcx since you need to download the latest from the vfpx site.

just open the form in vfp and when it asks you for the imgcanvas navigate it to the gdiplusx.vcx on your computer. the form will then resolve the location correctly. save the form, set the default path to the directory where the form is (to find the images) and then run the form. i have subclassed the imgcanvas class from the gdiplusx.vcx class library. unfortunately this would happen since i don't supply the gdiplusx.vcx and i don't know where a user might have stored it.

enjoy.

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

13 Responses to Aqua Buttons with GDI+x and VFP

  • Zaheer says:

    Buttons are fantastic !

    Thanks Bernard for sharing your ideas.

  • Excellent class Bernard !!

    I can translate this article into Spanish and published in http://www.PortalFox.com

    Sure. I already gave you the Ok for all the other posts.

    Thanks.

  • eduard says:

    great, u’re the best man 🙂

  • 4r1e says:

    wow, very good; thanks bernard for sharing

  • Bo Durban says:

    WOW! Thanks Bernard. This is a really cool class. One enhancement request 😉 it would be nice to have a preview of the button on the Builder form, sice we can’t view it on the form at design time.

    Thanks,
    Bo Durban

    Excellent Idea Bo. Consider it done soon in the update.

  • Cesar says:

    Hey Bernard,

    Super coooool !

    It’s really nice to see that you’re making GdiPlusX shine ! For your latest creation, you associated many different drawing techniques, and obtained a great result.

    Congratulations, and thanks for sharing !

  • Jissé says:

    Difficult to make more effective

    Great art

    Thank you very much

  • Paco Satue says:

    Hello, I am not speak good English.

    This is an idea to display the button at design time.

    * End of method aquabuilder.SaveChanges
    LOCAL loCaptureBmp AS xfcBitmap, lcShowPicture
    lcShowPicture = THISFORM.oSource.PICTURE
    IF EMPTY(lcShowPicture) OR ;
       NOT FILE(lcShowPicture)
    lcShowPicture = FORCEEXT(ADDBS(SYS(2023)) + SYS(3),’PNG’)
    ENDIF

    INKEY(0.1) && Delay to paint the button
    loCaptureBmp = _SCREEN.SYSTEM.Drawing.BITMAP.FromScreen(THISFORM.Aquabutton1)
    loCaptureBmp.SAVE(lcShowPicture, _SCREEN.SYSTEM.Drawing.Imaging.ImageFormat.Png)

    IF FILE(lcShowPicture)
    THISFORM.oSource.PICTURE = lcShowPicture
    ELSE
    THISFORM.oSource.PICTURE = ”
    ENDIF
    *****************************************

    Thank you

    Thanks

  • Koen says:

    Hi Bernard,

    Thanks for sharing. An excellent add-on.
    Looking forward for your next invention.

    Checkout http://weblogs.foxite.com/bernardbout/archive/2008/10/03/6984.aspx

  • Norman says:

    Great Bernard,

    I realy like this style from you & I just become fan of you!!!

    I have a problem— I cann’t download GDIPlusX.vcx from that link.. Plz tell me the way how can I get that one….

    Plz Plz I’m very excite……

    Click the link Latest Release of GDIPlusX on that page and download the stable release. GDIPLUS.VCX is included in the Source directory of the zip.

  • NareshDhakecha says:

    Sorry Bernard,
    i’m still not able to get gdiplusx.vcx…

    Download remains 80-90 % and stops ….

    Plz can you supply me ?

    If I had your email address…

  • This is working really nice. I just wonder why I cannot make the glow buttons get to work.

    BL

    I don’t know. Maybe you didn’t follow the simple instructions?. Check out the tutorial link as well.

  • Nigel Reburn says:

    Hi Bernard,

    I have been using for for many years and have always been able to get it to do what I want. This stuff you are doing with graphics is just on another level altogether!

    In comparison I am trying to do something very simple to show a picture of a circuit board with tracks that an engraving machine will follow. All I need to do is have a bitmap on a scrolling form and then draw on it so that I can then scroll the form around and see the changes. How can this be done without having to keep refreshing the drawn lines? Do you have a simple example of how to draw on a bitmap please?

    Send me your email and I will get back to you.

    I need to see what you are trying to achieve. Drawing lines is one thing but for a proper solution, I need more info, maybe a picture = 1000 words?

Leave a Reply

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