#DEFINE ARGB_RED 0xFF00FFFF #DEFINE ARGB_BLUE 0xFF0000FF PUBLIC o o=CREATEOBJECT("MyForm") o.Show() ********************************************************* ********************************************************* ********************************************************* DEFINE CLASS MyForm AS Form AutoCenter = .T. Width = 240 Height = 240 cTempFile = "" nColor1 = ARGB_RED nColor2 = ARGB_BLUE ADD OBJECT cntFill AS Container WITH ; Top = 20, Left = 20, ; Height = 200, Width = 200, ; Anchor = 15 ADD OBJECT btnOne AS COmmandButton WITH ; Top = 100, Left = 100, ; Height = 25, Width = 100, ; Caption = "Push Me!" ********************************************************* FUNCTION Init() This.cTempFile = ADDBS(SYS(2023))+SYS(2015)+".bmp" This.cntFill.Resize() ENDFUNC ********************************************************* FUNCTION Destroy() DELETE FILE (This.cTempFile) ENDFUNC ********************************************************* FUNCTION cntFill.Resize() CLEAR RESOURCES (ThisForm.cTempFile) MakeGradientPicture(ThisForm.cTempFile, This.Height, ; ThisForm.nColor1, ThisForm.nColor2) This.Picture = ThisForm.cTempFile ENDFUNC ********************************************************* FUNCTION btnOne.Click() ThisForm.nColor1 = 0xFF000000 + RAND()*0xFFFFFF ThisForm.nColor2 = 0xFF000000 + RAND()*0xFFFFFF ThisForm.cntFill.Resize() ENDFUNC ENDDEFINE ********************************************************* FUNCTION MakeGradientPicture(cFileName, nHeight, nColor1, nColor2) DECLARE Long GdipCreateLineBrushI IN GDIPLUS ; String point1, String point2, ; Long color1, Long color2, ; Long wrapMode, Long @lineGradient SET CLASSLIB TO HOME()+"ffc\_gdiplus" ADDITIVE ** Get screen Graphics context oGfxS = CREATEOBJECT("gpGraphics") oGfxS.CreateFromHWND(0) ** Create a bitmap oBmp = CREATEOBJECT("gpBitmap") oBmp.CreateFromGraphics(oGfxS,1,nHeight) ** Get a bitmab graphics object oGfx = CREATEOBJECT("gpGraphics") oGfx.CreateFromImage(oBmp) ** Get a gradient brush hBrush = 0 GdipCreateLineBrushI(BINTOC(0,"4rs")+BINTOC(0,"4rs"), ; BINTOC(0,"4rs")+BINTOC(nHeight,"4rs"), ; nColor1, nColor2, 0, @hBrush) oBrush = CREATEOBJECT("gpBrush") oBrush.SetHandle(hBrush) ** Fill the bitmap with our gradient oGfx.FillRectangle(oBrush,0,0,1,nHeight) oBmp.SaveToFile(cFileName,"image/bmp") oGfx = NULL oBrush = NULL oBmp = NULL oGfxS = NULL RETURNHope this helps,