fgGradientButtons (Buttons with Gradient-Color)

Discussion in 'Additional Libraries' started by Filippo, Oct 10, 2009.

  1. Filippo

    Filippo Expert Licensed User

    Hi,

    here is my new library. With this library you can create a button with a gradient and rounded corners.

    The desktop version is just a dummy library, it generates only normal buttons with no gradient.

    .NET Compact Framework 2.0 or higher is required.

    The zip file also includes a examples and a Help-File.


    Version 1.002 ;
    1. Property "WithPressedEffect" with Shadow effect.
    2. Button with AutoScale


    Version 1.004 ;
    1. The desktop version is no longer a dummy library.
    2. Fixed errors on Shadow effect


    Version 1.005 ;
    1. I changed the order of parameters in the method new2:
    2. from ...left,top,height,width,.. to ...left,top,width,height,..


    Version 1.006 ;
    1. 2 new Property and 1 new method added:
    2. DockStyle
    3. AnchorStyles
    4. AddContextMenu


    Version 1.007 ;
    1. Property ControlRef added:
    2. errors corrected in the Anchor property

    Version 1.008 ;
    1. Property ImageMode added: cCenterImage, cStretchImage, cNormalImage
    2. Property TextAlignment added: alLeft, alCenter, alRight

    Version 1.009 ;
    1. B4P-Autoscale added
    2. Property WithShadows added
    3. Property WithPressedEffect changed: 1.Clik=Button pressed, 2.Clik= Button released
    4. Events added: ButtonPressed, ButtonReleased


    Ciao,
    Filippo
     

    Attached Files:

    Last edited: Aug 22, 2010
  2. ExcludeReality

    ExcludeReality Active Member Licensed User

    Very useful library!
    Personally I like to design my own buttons with Paint.NET, but this is a terrific idea.
    I'm sure it will come in handy

    JOOC; Why is this library not available for desktop?
     
    Last edited: Oct 10, 2009
  3. Erel

    Erel Administrator Staff Member Licensed User

    Great work. Thanks :)
     
  4. derez

    derez Expert Licensed User

    Filippo
    A very nice and usefull library, Thank you.

    Can you please add a short description (instead of us playing with the example until all is clear ?).

    Edit: I can see all through the menu !
     
    Last edited: Oct 10, 2009
  5. Filippo

    Filippo Expert Licensed User

    Hi derez,

    a short Help-File is included.

    @ExcludeReality
    I do not knows why but it will not just work.:(
    But I don't care about. It's important for me that it works on the pocketpc.

    Ciao,
    Filippo
     
  6. Cableguy

    Cableguy Expert Licensed User

    Hi filippo,

    I am porting some of my code into a dll, hoping that doing so will make it work faster and smoother.. It uses 1 of your FgGradiantButtons, and I would like to keep them..So I ask if you could share the .cs file, for merging, and if I can have your permition to merge it into my dll, with given credits.
     
  7. agraham

    agraham Expert Licensed User

    It needs visual styles enabling for the application on the desktop but the gradient still doesn't show :confused:
    .
    Code:
    obj1.New1(False)
       obj1.CreateNew(
    "System.Windows.Forms.Application" & obj1.System_Windows_Forms)
       obj1.RunMethod(
    "EnableVisualStyles")
       obj1.SetProperty(
    "VisualStyleState""ClientAndNonClientAreasEnabled")
    EDIT:- Forget visual styles, I was wrongly assuming it was an override of a standard Button. After poking around a bit I see that the desktop library does not actually try to implement the gradient filled button but is just an ordinary one. Filippo must have found some difficulty in getting the code to work on the desktop :(.
     
    Last edited: Nov 7, 2009
  8. Filippo

    Filippo Expert Licensed User

    Hi Cableguy,

    my DLL is written in vb.net, so there is none. cs-file.

    @agraham
    :sign0013:
     
  9. Cableguy

    Cableguy Expert Licensed User

    Could you please share the source so that we/I can try to port to c#?
     
  10. Filippo

    Filippo Expert Licensed User

    Hi,

    i have updated my library, Version 1.002.
     
  11. Filippo

    Filippo Expert Licensed User

    Hi,

    i have updated my library, Version 1.004.
     
  12. Byak@

    Byak@ Active Member Licensed User

    good work!
     
  13. derez

    derez Expert Licensed User

    Filippo

    I am replacing the buttons of several application with your new buttons.
    After replacement of a button there is some additional work to find all the places where the button color or fontcolor is changed, and to replace them with your definitions:
    button.color ---> button.backcolor
    button.fontcolor ---> button.forecolor

    It would be nice if you can change the properties names to be the same as in a regular button.:)

    One more thing:
    The order of the parameters in the new2 method is:
    New2 (FormName As String, Text As String, ForeColor As Color, FontSize As Integer, Left As Integer, Top As Integer, Height As Integer, Width As Integer, StartColor As Color, EndColor As Color, IsGradientVertical As Boolean, RoundedCorner As Boolean )

    It would be more logical to put it like this:
    ....left,top,width,height,...


    I know it is not really a big issue but since I like the new button I am going to do a lot of replacements and it will save me some errors.

    Thank you !:)
     
    Last edited: Dec 30, 2009
  14. Filippo

    Filippo Expert Licensed User

    Hallo derez,

    thanks for the advice, I will change it in the next version.

    The property "button.color" and "button.fontcolor" are not vb.Net concurring, check out the 2 images.


    Ciao,
    Filippo
     

    Attached Files:

  15. Filippo

    Filippo Expert Licensed User

    Hi,

    i have updated my library, Version 1.005.
     
  16. derez

    derez Expert Licensed User

    Thanks filippo, that was quick...

    I attach a tool that I wrote for transforming existing application to have fggradientbuttons instead of the regular buttons.

    To use it you need to open the application source code in notepad and copy the "sub designer" part to a new txt file named src.txt. Do not try to change or save the file from notepad - you can loose your application.

    Then run fgfile and open dst.txt which is created by the program. The file includes the new lines with the fgbuttons object definitions, for all the regular buttons in the application. You delete those that you dont want to change from the text, and delete those that you do want to change from the forms using the visual designer.

    The start color is fixed in the program but of course it can be changed easily.

    Remember also to find all places in the application where reference to button color is done and change it to endcolor or backcolor or forecolor etc. accordingly.

    The comments with "vga" are for cases of changing an application for desktop which is based on a device application and use vga parameter to increase its size. by the way - GetControls does not catch fggradientbutton !:confused:

    When thinking about it - the tool can be used for design of new applications as well - you design with the visual designer, putting regular buttons as you find fit and then change them to fg buttons by this tool.

    Have fun :)
     

    Attached Files:

    Last edited: Jan 1, 2010
  17. Zaam

    Zaam Member Licensed User

    The buttons look awesome, I look forward to include them in my current app and most likely all future apps I'll make. Thanks a lot for your work :)
     
  18. Filippo

    Filippo Expert Licensed User

    Hi derez,

    Your Procedure is really good!

    The Library fgGradientButtons does not need a VGA parameters when the buttons with the method New2 created. Look at the 2 pictures.

    Example with GetControls:

    Ciao,
    Filippo
     

    Attached Files:

  19. derez

    derez Expert Licensed User

    Filippo

    I use vga parameter to convert applications written for device, to the desktop. I do it with the sub used in the past, before there was optimized compilation for VGA.

    Now that you showed me that Getcontrols works when the type is defined as "fgButtons.fgButtons.fgGradientButtons" (instead of just "fgGradientButtons" ) I don't need the commented part in the fgfile any more - the position stays as for the device, and the VGA sub multiply it by the vga factor.

    I was thinking about elaboration of the tool - to enable the user to control each new line and decide if it has to be one color or two, or replaced at all.
    It can be done easily but I already converted all my programs...maybe I'll do it anyway.

    Thanks.
     
  20. Filippo

    Filippo Expert Licensed User

    Hi derez,

    I added the control "ImageButton" in your procedur .
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice