2020-04-12

GRADIENT OBJECTS WITH GDI+ REVISITED

Here's the latest version of the GradientObjects class.

Many thanks to: Craig Boyd, Bo Durban, Emerson Reed, Malcolm Greene, Keith Gordijn, Luis Navas, Ana Bisbe, Ailsom Heringer, and all others that have tested the class, providing valuable suggestions and feedback.

The main modification from the previous version is the creation of a new class, as Craig Boyd suggested:

“... create a custom class that provides this functionality rather than have the code directly in the button class. A class that uses bindevents to link itself to the buttons (or whatever ui element is being used) would provide an additional level of abstraction. this would allow developers to use the class with other ui elements (such as a container) and also provide a quick and easy way to add this cool functionality to existing applications where they have their own button subclasses (or are using vfp base class) already existing. Toss the class on the form and set some properties.”


Another important modification was to “turn any optionbutton or checkbox with its style property set to graphical to a gradient button.” as Bo Durban suggested.
Emerson Reed also provided many images showing the desired behavior of the class.

Features :
  • drop one instance of the class in the form or container, and all buttons will be converted to gradient. applies to commandbuttons, graphical checkboxes and graphical listboxes
  • 9 kinds of gradients
  • choose different backcolors when object has the focus and not.
  • create greyscale images for disabled buttons
  • picture position
  • converts picture borders to transparent (no matter what color is used)
  • hotkeys (\<) specified in the caption property display normally, and remain functional.


How it was created:
  • the class creates a new picture image file that will imitate the original appearance of the button, using all text properties, like caption, fontbold, fontitalic and the original picture, all redrawn in a specified gradient background.
  • extensive usage of gdi+ to create images, 100% with direct api calls, to obtain the maximum speed in the creation of the images that will be substituted in the buttons.
  • in the first moment, only the main images from the buttons are created. only when the mouse or focus is over a specific object that the class creates the “selected image”. the same happens with the “greyscale disabled pictures”
  • many events are controlled using bindevents, such as : mousemove, mouseenter, gotfocus, lostfocus
  • three different kinds of gradients were created using different functions.
  • for gradientmodes 1 to 4, i used gdipcreatelinebrushfromrecti, to create a simple linear gradient brush with 2 colors.
  • for gradientmodes 5 to 8, gdipcreatelinebrushfromrecti was again used in combination of gdipsetlinepresetblend, that according to MSDN "defines arrays of colors and positions used for interpolating color blending in a multicolor gradient". it was used to create a 3 color gradient, starting with backcolor1 property, with backcolor2 in the center and again backcolor1 in the other edge.
  • for gradientmode 9, i created a PathGradientBrush, using gdipcreatepath, gdipaddpathrectangle, gdipcreatepathgradientfrompath, gdipsetpathgradientcentercolor and gdipsetpathgradientsurroundcolor. there is a very cool example of this usage in last Craig Boyd's article published in foxtalk 2.0. the surround color is defined by backcolor1 property. The center color is backcolor2.
  • the gdi+ imageattributes class is used to apply a color matrix to create the greyscale images for the disabled buttons. It is also used to create the transparent background of the pictures using the remap table function.
  • the hotkeys are enabled using the StringFormatHotkeyPrefix

Properties of the class to be set
Check the favorites tab in the properties window.
         
  • BackColor1 - numeric, the RGB value of the starting color of the gradient background when the object does not have the focus and the mouse is not over it.
  • BackColor2 - numeric, the RGB value of the destination color of the gradient background when the object does not have the focus or the mouse is not over it.
  • SelbackColor1 - numeric, the rgb value of the starting color of the gradient background when the object has the focus or the mouse is over it.
  • SelbackColor2 - numeric, the rgb value of the destination color of the gradient background when the object has the focus or the mouse is over it.
  • CaptionForeColor - numeric, if set, overrides the forecolor originally set in the controls
  • Captionbold - logical, if set, overrides the captionbold originally set in the controls
  • CreateBorder - logical, sets the border with the color background1 color
createborder = .T.
          

createborder = .F.
           
  • GradientMode - numeric, from 1 to 9, determines the gradient type to be applied to the buttons.
1 - horizontal 2 - vertical 3 - diagonal 1 4 - diagonal 2 using linear gradient brushes with 2 colors
5 - horizontal 6 - vertical 7 - diagonal 1 8 - diagonal 2 using linear gradient brushes with 3 colors, where the surrounding color is backcolor1 and the center color is backcolor2
9 - rectangular pathgradient, where the surrounding color is backcolor1 and the center color is backcolor2
          
         
          

  • ReduceColorLevel - numeric, automatically sets the destination color of the gradient (BackColor2 and SelBackColor2) ranging from 0 (no change) to 100 (white). if left to .f., then no change is applied and the original values of BackColor2 and SelBackColor2 will be used.
  • CreateDisabledPicture - logical, .t. = create a grayscale picture of buttons to be used when one or more controls are disabled.
         
  • MouseDownEffect - logical, determines if the button will become darker or brighter when mouse is down
  • MouseDownBrightness - numeric, brightness in percentage. -100 = black; 0 = no change ; +100 = white
  • TranspImgBack - logical, determines if the picture will have its background converted to transparent (alpha = 0). by default, the class will admit that the color of the 1st pixel, coordinate (0,0) has the background color, and will substitute all pixel colors that match that color to transparent.
         
Redrawing a specific object
In many cases, we need to change programatically some properties of some buttons, like the caption. When using this class, you need to call the updatecontrol method of the class, like in the example below:
Thisform.CmdButton1.Caption = "new caption"
Thisform.CmdButton1.FontItalic = .t.
Thisform.GradObjects1.UpdateControl(Thisform.CmdButton1)

Assigning different effects to some specific buttons
That's very easy to accomplish. Put the CommandButtons in a separate container, and drop an instance of the class, setting the properties as needed.
Below you can see a form in development mode and the resulting when the form is executed.

         

         



Disclaimer
This class is totally free. The information provided on this page and the source code related to this article comes without any warranty whatsoever. Use it at your own risk.

68 comments:

  1. Excellent Work !!!

    thanks for sharing your knowledge with us


    ReplyDelete
  2. Juan Antonio SantanaJuly 27, 2006 at 10:48 AM

    Hi Cesar,


    Looks like a great work !!


    I can not see the link to download the file

    ReplyDelete
  3. Sorry for the missing link :-((

    You can download the source code directly from this link.

    http://www.geocities.com/macmarbr/gradobjects.zip

    Thank you !

    ReplyDelete
  4. Amazing you my friend. Thanks a lot for sharing it with us.

    ReplyDelete
  5. Hi Cesar, one simple question, can you make it to use for example predefined themes for the gradients? for example a one like office 2003, etc.


    Thanks

    ReplyDelete
  6. Hi Luis,

    Yes, I think that'd be possible, but I must confess that I'm not familiar with themes. Unfortunately, I don't have Office 2003. Can you provide some images showing the desired effects ?

    ReplyDelete
  7. Got your new gradobjects class and will be applying it to one of my projects over the weekend, many thanks for your great work.

    ReplyDelete
  8. It would be very good that you see the possibility of putting it as project it departs from VFPx.


    I repeat my congratulations.

    ReplyDelete
  9. Hi Cesar:

    Great work! Y would suggest using jpeg compression for the images, so they save and load from disk faster and the form loads faster too.

    Regards!
    Fernando, Thanks for the suggestion, I've just tested here and in my machine with JPEG compression it is running 10% slower...
    You can try it yourself, just changing one line in the "draw" method of the class. At the end of the code of this method, change the value of lqCLSIDEncoder to make it save as JPEG:
    lqCLSIDEncoder = 0h01F47C55041AD3119A730000F81EF32E && JPG

    ReplyDelete
  10. Hi Cesar,


    Thanks for sharing! We will be applying this great cool looks on our current developments.


    Thanks again!

    ReplyDelete
  11. Hi Cesar,


    This is Art!

    Thank you very much


    ReplyDelete
  12. Any way to create nice VFP Toolbars with grandient Colors???
    Hi Plinio, I've been thinking of that. The main difficulty is that toolbars don't have a "Picture" property. Maybe the best solution is to add a Container object and add the CmdButtons to this container. That's a good idea for the future. All ideas and suggestions on this subject are very welcome.

    ReplyDelete
  13. Hi Cesar:

    Thanks for your great work.

    Everything works great except hotkeys (\<) specified in the Caption property. Hotkey is displayed correctly but it is not functional. What I have to do to make it works?
    Hi Pero, Thanks for advising. I'll fix that and hope to publish the fixes in the next update of the class.

    ReplyDelete
  14. Thank you my friends for the kind words and feedback.
    Your opinions are very valuable to improve the class. I'll be working on the suggestions and bugs you've pointed, and hope to publish a new version soon.
    Regards,
    Cesar

    ReplyDelete
  15. Hi Cesar,

    I have a bug too. I click on "Shutdown" and nothing happens!!! -:)
    Hey Vassilis,
    That's just a sample ! Nothing was expected to happen ... lol  :-)))

    ReplyDelete
  16. 07-31-06   UPDATED VERSION OF THE CLASS
    FIX : HotKeys in captions "\<" now working normally.
    FIX : When the you pass the mouse over a button that has the focus now it keeps the selected effect.
    FIX :  If a user deletes the BackColor property value and change it to (None) the control will force a default in this case. A safety measure, thanks to Bernard Bout.
    UPDATE : New Form showing how to add many different gradients in a form. See "twoGradients.scx" in the main folder.

    ReplyDelete
  17. Congratulations for the job!

    Bem, agora que deu um tempo vi o que vc andou fazendo com imagens, aproveito para perguntar se da para tornar a imagem dinamica, isto é,  capaz de se mover, ou parecer que se move. Deixa eu explicar...
    Tenho uma rotina em um form do seguinte tipo em um objeto Timer:

    * ROTACIONA O TEXTO EXIBIDO
    THISFORM.label1.CAPTION =  ;
    SUBSTR(THISFORM.label1.CAPTION,2) + ;
    LEFT(THISFORM.label1.CAPTION,1)

    *MUDA AS CORES DA FRENTE DO TEXTO ALTERANDO AS CORES
    THISFORM.label1.FORECOLOR = (THISFORM.label1.FORECOLOR + 252 * 252) % 256^3

    Ao rodar este código, eu estou rotacionando o caption do label, o que eu gostaria de poder fazer é poder fazer um jogo de animação com a cor do formulário, para que se possa fazer um efeito especial da esquerda para a direita alterando a cor, como se movesse uma cortina...ou as demais opções de mudança de um quadro para outro como existe no PowerPoint.
    É possivel fazer isto?
    Deu para entender?
    Existe alguma forma de rotação e mudança de cor para dar a sensação de movimento ?
    Não sei se fui muito claro...
    Da qq. forma parabens pelo que tem feito !

    Hi Peter,
    Thanks for the kind words. To create some dynamic effects, there are two ways:
    1 - change the style of the commandbutton to "Invisible", and add an image object over it, with an animated GIF with the effect. Unfortunately, the redistributable version of gdiplus.dll version does not allow the creation of animated GIFs.
    2 - add a timer object, and create many images on the fly, simulating the desired effects.
    Abração !

    ReplyDelete
  18. 08-03-06   UPDATED VERSION OF THE CLASS
    FIX : BUG IN LOSTFOCUS / GOTFOCUS
    UPDATE : Method "UpdateControl" allows to change the object colors
    UPDATE : Method "ChangeColors" allows values from -100 to + 100.  -100 = Black; 0 = No change; +100 = White
    UPDATE : Form "TestGradAnimation.scx" showing how to make a button "Blink" with the effects
    UPDATE : New Properties "MouseDownEffect" and "MouseDownBrightness"
       "MouseDownEffect" Logical, determines if the button will become darker or brighter when mouse is down
       "MouseDownBrightness" Numeric, Brightness in percentage. -100 = black; 0 = no change ; +100 = white

    ReplyDelete
  19. It is good work, its make visual fox queen.

    ReplyDelete
  20. Grande Cesar!
    Você deve dormir GDI, comer GDI, Ver GDI....
    Tantos exemplos bons utilizando GDI só podem estar te tirando o sono....
    Muito bom mesmo a sua técnica....

    Parabéns!
    Gelson, vc é um dos meus ídolos em VFP. Acho que já está na hora de vc se juntar a nós e nos apresentar suas "criaturas" em seu próprio Blog ! Abração !

    ReplyDelete
  21. Que é isto Cesar!?
    Não estou com esta bola toda não...
    Mas um blog é uma boa idéia....
    Vou pensar no caso....

    Tenho acompanhado os teus exemplos,
    e te digo, estão muito bons, você é que deve ter uma legião de fãs....
    heheheh.....

    abraços!
    Ôpa ! Pense então com muito carinho. Vc tem bastante coisa legal pra passar e discutir com o povo. O Foxite é uma casa muito "aconchegante", de ótima visibilidade na comunidade VFP. O legal de escrever em inglês (mesmo que capengamente) é atingir um maior numero de pessoas. Ao recebermos o feedback, nos facilita demais o desenvolvimento, a correção de bugs, além de receber valiosas sugestões. Vc não se arrependerá. Abração !
    Gelson is the creator of the "Capture Screen Portions" program that I posted some months ago, and probably will start his blog here at Foxite.

    ReplyDelete
  22. Respected Sirs,


    For some reason (access denied) I am unable to download this gradobjects.zip file so will u pl. sent as an attachment to the abvoe said URL (bkdd@rediffmail.com)


    Thanks.

    ReplyDelete
  23. Cesar,


    Beautiful! I'm speechless - you make the Fox ROCK!!!


    THANK YOU VERY MUCH!


    Malcolm

    ReplyDelete
  24. E ai Cesar?

    Passei por aqui novamente, estou bem ausente mesmo, hehehehe....

    Principalmente do fórum.... Tens participado?


    Cara estou pensando em ter o meu blog como vc me colocou acima,

    mas me diga uma coisa, isto não te tira muito tempo não?

    ReplyDelete
  25. great class Cesar .. this is the best thing i've had the pleasure to encounter from some time .. i will have to tinker with it a little to incorporate it in my apps but i'm looking forward to it as i'm shure i'l learn a great deal from it ..

    btw .. if i add a command button at runtime or want the same effect for other controll based on container, shape, or other visual class, how can i link it to your class? .. the UpdateControl doesn't seem to handle this as all the custom properties ar added at initialisation.
    a new method for the purpose of binding a new object could be verry useful

    all in all .. this is great work .. and i thank you for it ..  all the way from romania ;)

    Hi Eddy,
    Good catch !
    I must admit that I had never thought on that possibility... I'll work on that, and hope to update the class, addong some other fixes.
    Thanks for your feedback ! I really apreciate !

    ReplyDelete
  26. Hy Eddy,


    I've already modified the class to work in this situation, please download the new version and let me know how it works for you. I've included a sample that deals with this situation. Thanks very much for your feedback!

    ReplyDelete
  27. Great buttons and effects. I haven't dug into the class object yet, but has anyone looked into what happens when the button resizes? If you setup anchoring, ie. set the buttons anchor value to 240, run the form, and then resize it you get some weird results.  I'll let you know if I find something for this. Thanks again for the cool work!
    Good catch !
    This can be probably solved, by using BINDEVENTS for the Resize event of the parent container or form or binding to the Width and Height properties of each control.
    I'll probably add this feature for the next update of the class.
    Thanks for reporting !

    ReplyDelete
  28. Hey Jeremy,

    I've just updated the class, in a way that every time that width or height is changed, the control will be redrawn.

    Please Download the latest release and tell me how it works.

    In the "Samples" folder I've included some controls that are resized when the form resizes. Please run TESTRESIZINGBUTTONS.SCX and tell me what you think.

    I'll apreciate your feedback on that.

    Thanks

    Cesar

    ReplyDelete
  29. 07-02-27 UPDATED VERSION OF THE CLASS: 

    FIX: Applied fixes on string measurements to obtain more accurate measurements
    FIX: UpdateControl Method for "MouseDown"
    FIX: Changed all GDIPLUS declarations to avoid confusion from VFP
    FIX: Used Bindevents to make sure the class will activate only after all objects were initialized
    FIX: Every time that width or height is changed, the control will be redrawn in the new size.
    FEATURE:  Included code to allow adding new objects on the fly using the "UpdateControl" method
    FEATURE: Added new class for GradientBackgrounds - version 1 - BETA - using _gdiplus.vcx
    FEATURE: Added Memberdata Scripts to ease selecting colors, opening the colorpicker when dblclick on the ellipsis
    UPDATE: Included new samples: "EssaiFondEcran.scx", "addingObjects.scx", "testresizingbuttons.scx" 

    ReplyDelete
  30. Great improvement for the resizing! Works great and no artifacts on the screen. One thing I tried also is to increase the fontsize as controls enlarge. Not sure why this wasn't included in Fox with anchoring. You may know more appropriate code, but I've added to gradobjects.UpdateControl
    IF .BaseClass == 'Commandbutton' THEN  && Alter for other control types.
       .Fontsize = .Height / 4
    ENDIF

    which seems to work well enough to set a decent fontsize to match the button.
    And again, gradobjects is a awesome improvement on VFP.
    Great ! I'm glad to know that it solved your problem.
    To change the FontSize, we could store the original FontSize, and change its value proportionally to the new size of the control. Another way would be to use GdipMeasureString to obtain the font size that will best fit to the rectangle available to draw the text. If you have any other ideas, or have any bugs to report, please feel free to use this space !
    Regards
    Cesar

    ReplyDelete
  31. Fantastic effort Cesar,

    I have one suggestion though : it would be useful if you redefined the many Hidden properties and methods in your classes as Protected instead, so that we can add our own functionality to your system by simply subclassing your classes and leaving your base classes untouched.
    Hi Paul,
    Sounds good, I hope to change these properties and methods in the next release, ok ? Anyway, if you have any suggestion of some specific cases or behavior that the class still does not support, feel free use this space to tell.
    Thanks very much for the suggestion.
    Regards
    Cesar

    ReplyDelete
  32. Hi, Cesar!

    Thanks for your hard job from all russian VFP users!

    Please, don't change all Hidden properties in your classes to Protected!
    There is known problem regarding VFP9 SP1 and all JR VFP versions. When you do any calculations and use next piece of code (see below), this code throw an error and work not correct with ALL visual Protected properties like borders etc, by using subclassing! If you make a container with textbox, border and button, try set border to protected and run next piece of code. I think that is bug of SetAll methos of VFP!
    #define vbHourglass 11
    #define vbDefault 0
    With ThisForm
       .MousePointer = vbHourglass
       .SetAll('MousePointer', vbHourglass)
    EndWith

    && Do any calculation code...

    With ThisForm
       .MousePointer = vbDefault
       .SetAll('MousePointer', vbDefault)
    EndWith

    ReplyDelete
  33. I'm having a slight problem whilst using the gradient objects class. The base form class in our framework has a gradBackgound object on it and gives the desired effects. However, then next time the application is run in the VFP IDE, the splash screen loses it's image. Re-starting VFP sorts out the problem until the app has been run once. thereafter, the image is lost.

    If I open the splash screen and reselect the required image file on the image control, VFP gives me the error message that the "picture is too big, corrupt or in the wrong format".

    Again, if I restart VFP the picture is there in Design and Run mode, but not after the application has been run once.

    Positively weird.

    For various reasons, the splash screen and it's controls are VFP base classes, the image file is a jpg file.

    Any suggestions as to what might be causing this?

    Mark
    Hi Mark, thanks for your feedback. I suspect that this was solved in the latest version of the class, can you download it and tell me how it works? Thanks,
    Cesar

    ReplyDelete
  34. 07-06-27 UPDATED VERSION OF THE CLASS:


    FIX: Bug in graphical OptionGroup initialization

    ReplyDelete
  35. Hi Sir!


    When I run my application using the gradient object class, my application hangs. I checked the problem and found out that my form's Private Data Session causing this, then I switch to Default Data Session and it work. But I need to use the Private Data Session in some of my application.


    I test your sample and switch to Private Data Session and found no problem.


    Sir, what seems to be causing this problem on my apps?


    Thanks,


    Bernard

    ReplyDelete
  36. Hello Sir!
    When I use chinese word, appear some bugs. Can you help me?
    My Email is:wangteng0924@tom.com

    Thank you very much,

    Chinese friend
    Hi !
     
    Can you provide me some screenshots showing the problems that are occurring ?
    This seems to be a problem with the codepage, but I think that this can be fixed, but for this I'll need many screenshots, showing me how the Gradobjects class is showing wrongly the text, and how it should be appearing correctly.
     
    It would be great if you could provide me also the unicode codes from the text from the sample that you'll provide
     
    Regards
     
    Cesar

    ReplyDelete
  37. I was one of China's Probe procedures enthusiasts, thank you very much for providing such a good category, But one question is : When I use Chinese as the button caption attributes specified Chinese, in the form running, the button will appear on the superfluous characters .... Are you not in the category of the Chinese environment invoked? If you have time so, you have given me and my Chinese counterparts about ... back again appeal.
    Hi !
     
    Can you provide me some screenshots showing the problems that are occurring ?
    This seems to be a problem with the codepage, but I think that this can be fixed, but for this I'll need many screenshots, showing me how the Gradobjects class is showing wrongly the text, and how it should be appearing correctly.
     
    It would be great if you could provide me also the unicode codes from the text from the sample that you'll provide
     
    Regards
     
    Cesar

    ReplyDelete


  38.  I have now completed some screenshots , can tell me you the contact method,the mailbox or QQ all may... After you revise please again bequeaththe instance I, thanks

    ...

    ReplyDelete
  39. I have now completed some screenshots , can tell me you the contact method,the mailbox or QQ all may... After you revise please again bequeaththe instance I, thanks

    ReplyDelete
  40. I have screenshots sent to you afterwards, and has been no reply to me, I have been looking forward to ... Thank you

    ReplyDelete
  41. As and when try to use background, this message appears

    File 'gdipsaveimagetofile_i.prg' does not exist

    Nadeem,
    Please send me a SCX that generates this error, so that I can try to fix this.
    Thanks
    Cesar

    ReplyDelete
  42. I just try and i found error

    File 'gdipsaveimagetofile_i.prg' does not exist  for first time run in the fresh visual foxpro/ just open it, after that error you can run the form again and it working well
    after i try type "clear all"
    in command window that error appear again  
    thanks
    Thanks Agus !
    I've just fixed it, can you download the new version and try again ?
    Thanks in advance
    Cesar
     

    ReplyDelete
  43. addition
    that problem happen for Gradbackground , for GradObject thats fine
    Thanks for reporting !

    ReplyDelete
  44. Hi Ling Zi Ling

    Thanks very much for your help, patience and pictures. Your help was fundamental for fixing that issue with double byte characters (for Chinese and Japanese languages)

    Regards

    Cesar

    ReplyDelete

  45. I found a bug in wordwrap with the commandbutton.

    Thanks in advance

    ReplyDelete
  46. Many Thanks Cesar for sharing! We will make it possible for our users to take advantage of your offer

    ReplyDelete
  47. Hi,


    If there is no object selected on a page of pageframe, the mouseLeave event generates error on line "m.loActiveControl = This.Parent.ActiveControl", since there is no active control on the page. The help file says that this case WILL generae an error message. I have added an "on error" line and then it works fine, but I think this is a crude solution.


    Can there be any other solution?

    ReplyDelete
  48. Hi,

    Is there a way to apply the class in a Grid Control?  It will be a lot cooler if the class can handle grid controls.  

    Looking forward with this feature...

    Thanks for the great tool....
     
    Hi Mike,
    Thanks for your interest and for the suggestion. In fact, it is possible to apply the gradients to GridHeaders. Other people found that some code is needed to handle the "WordWrap" property as well... At this moment, I'm on some other projects - FoxCharts, but I hope to find some time to add this feature soon.
    Regards
    Cesar

    ReplyDelete
  49. Luiz Alexandre RuizJune 9, 2008 at 6:50 PM

    Olá Cesar,

    Em primeiro lugar lá vai mais um elogio....rsrsrs....show o seu estudo e disponibilidade de auxiliar os pobres-mortais...rsrsrs... a utilizarem o GDI+.
    Agora a pergunta, é o seguinte eu vou tratar uma imagem colocando sobre ela vários objetos, por exemplo: uma circunferência, mas eu gostaria que está ficasse manipulavel (circunf.), como se ela estivesse em um layer e na seqüência eu tivesse uma forma de gravar isto e manipulá-lo depois da mesma forma que na criação. Não sei se me fiz entender. Desde já agradeço a sua atenção.
    Olá Luiz,
    Na verdade, me parece que vc está querendo trabalhar com vetores de imagens, seria isso ? Nesse caso, sugiro que vc desse uma olhada no projeto "VFPPAINT", aqui nesse blog mesmo. Só que a cada desenho de imagem, vc deverá gravar o que foi desenhado em uma tabela, para poder depois fazer alterações ou reproduzir a imagem...
    Ajudou ?
    []s
    Cesar

    ReplyDelete
  50. How about Command group, how to make gradient command in command group.
    Oh yes...
    Thanks for your comment. I never used CommandGroups. I presume this will not be difficult to add to the class. Please stay tuned, and soon I hope to add this possibility !

    ReplyDelete
  51. hi
    i m sanjay and used ur calss. it is realy great but one problem is thai whet command button have word wrap =.t. it does not wrap
    my mail is sanjayhsp2005@yahoo.com
    Hi Sanjay,
    Thanks very much for your comment. That's true, I forgot to take care of buttons with "WordWrap" property. Unfortunately, I can't guarantee to you that I'll be working on it very soon. I have to finish some other projects right now, but be sure that I wont forget :-)
    Best regards
    Cesar

    ReplyDelete
  52. Hi, sorry for my english, i'm italian.


    i've problem using picture in command button with gradobjects, the picture is visible when exe run in original directory, if i copy the exe program in other directory the picture are not displayed.

    Can u tell me a solution.


    Best regards


    Raffaele

    ReplyDelete
  53. Hi,

    I am trying your nice class but in some form I get an error:

    "Function argument value, type, or count is invalid. "

    in following line:

    UuidFromString(s, @guid)

    method is Str2Guid() in gradbackground.

    Gradbackground is on a pageframe-page. In most case it works fine and I have no idea what is happening here. It seems that "UuidFromString" gives a character-guid back when the error comes.


    Do have any ideas, what I can do?

    Best wishes,

    Burkhard

    (VFP9 SP2 and XP)

    ReplyDelete
  54. Great class!  However, I'm having an issue running it in Vista.  Is anyone else having this issue?


    Any advice that you can give me would be greatly appreciated.


    Jim C./New Jersey

    ReplyDelete
  55. I'm having trouble with long captions on short buttons.  I cannot use word wrap while using this class.  Any solution or workaround to this?
    Hi Andy,
    Unfortunately, WordWrap is not suported YET by Gradobjects. BTW, the issue of the SET TALK in FoxyPreviewer was completely solved, I expect, can you confirm this ?
    Thanks !

    ReplyDelete
  56. is lost when loading icon button in the form, es recurente en cuanto al boton o el objeto al que no se le muestra la imagen.

    ReplyDelete
  57. I recived the follow error:


    File 'gdipsaveimagetofile_i.prg' does not exist .


    Why?????

    ReplyDelete
  58. Hi Cesar,
    it's the very first time I use GDIPLUSX (and GDI+) and ... I find a bug (sorry a feature !) in gradobjects.vcx class gradbackground method evaluatecolors.

    You have a test to see if we are in a page of a pageframe and then you 'reset' This.gradientmode according to the tabs orientation. BUT a pageframe may not have tabs if the property pageframe.tabs = .F. and then pages are pure rectangles (and it's my case : my main menu is a pageframe without tabs). So I modify the test as this :

    IF This.Parent.BaseClass = "Page" AND This.UpdateTabColor AND This.Parent.tabs=.T.

    it seems to work !

    Jean
    PS Hope you had a good time in Paris !

    ReplyDelete
  59. Hi cesar,

    just trying again to use the gradbutton class and i have a problem with wordwrap. Have you been able to work on it since 2010?
    Thanks for a reply

    ReplyDelete
  60. Hello JPS,

    I am sorry, you need to make the modifications by yourself. It's a long time since I don't use it!

    Salutations

    Cesar

    ReplyDelete
    Replies
    1. I have read that there is an updated GradObjects to the one I am using. Problem is...I cannot find it. It keeps trying to take me to sites that no longer exist. Can someone point me in the right direction?

      Delete
  61. excellent
    Thank you so much
    Only works on VFP 9 How can we integrate into VFP8

    ReplyDelete
    Replies
    1. Hello dear
      Does it support a copy VFP8 ?
      If it supports, please contact my email : abdoh20032000@gmail.com
      thanks

      Delete
  62. Hello dear
    Does it support a copy VFP8 ?
    If it supports, please contact my email : abdoh20032000@gmail.com
    thanks

    ReplyDelete
  63. Could it work with grid control?

    Thanks

    ReplyDelete
  64. Dear Cesar

    Could it work with grid control?

    Thanks and regards,

    Jazz

    ReplyDelete