GdiplusX drawings part II

Published on by Yousfi Benameur

This page presents 4 codes:

1-Chapitre I Basic Drawings
2-ChapII-Gradientbrushes in many styles and many colors
3-ChapIII-points,circles
4-Chap IV-watermarks text on image at a specified position-single or batch images
-Chapitre I Basic Drawings

*!*make some drawings with gdiplusX as curves,buttons,text,...

*!* using imgcanvas class

*!*drawing rectangles ,circles ,roundrectangles,

*!*using drawing2d lineraGradientsBrush,Pathgradie,Brush,paths

*:*using BlentriangularShape,Centercolor,Factors and Positions

*!*usings fonts and texts
*!* point to gdiplusX class and system.app (stable version) to make the code works

*!* 6 image sin the section below are part of this code.download them in same code location.

*make sur you have the latest version of system.app otherwise some effects are not available.


*Begin code
publi m.yrep
m.yrep=addbs(justpath(sys(16,1)))
set defa to (yrep)

DO (LOCFILE("System.app"))
set classlib to locfile("gdiplusX.vcx","vcx") addi

publi yform
yform=newObject("ygrad")
release classlib "gdiplusX"
yform.show
read events
return

DEFINE CLASS ygrad AS form
Height = 607
Width = 894
ShowWindow = 2
AutoCenter = .T.
Caption = "gdiPlusX samples drawing some buttons GdiplusX v1.10"
BackColor = RGB(255,255,255)
ycolor1 = 255
ycolor2 = 125478
r = 0
x = 0
y = 0
hover = .F.

ADD OBJECT imgcanvas1 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
Height = 60, ;
Left = 7, ;
MousePointer = 15, ;
Top = 12, ;
Width = 168, ;
Name = "Imgcanvas1"

ADD OBJECT imgcanvas2 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
Height = 60, ;
Left = 6, ;
MousePointer = 15, ;
Top = 96, ;
Width = 168, ;
Name = "Imgcanvas2"

ADD OBJECT imgcanvas3 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
Height = 72, ;
Left = 48, ;
MousePointer = 15, ;
Top = 168, ;
Width = 84, ;
Name = "Imgcanvas3"

ADD OBJECT imgcanvas4 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
Height = 60, ;
Left = 183, ;
MousePointer = 15, ;
Top = 12, ;
Width = 168, ;
Name = "Imgcanvas4"

ADD OBJECT imgcanvas5 AS imgcanvas WITH ;
Anchor = 0, ;
Height = 108, ;
Left = 360, ;
MousePointer = 15, ;
Top = 168, ;
Width = 240, ;
Name = "Imgcanvas5"

ADD OBJECT imgcanvas6 AS imgcanvas WITH ;
Anchor = 0, ;
Stretch = 2, ;
Height = 144, ;
Left = 363, ;
Top = 0, ;
Visible = .F., ;
Width = 157, ;
Name = "Imgcanvas6"

ADD OBJECT imgcanvas7 AS imgcanvas WITH ;
Anchor = 0, ;
Stretch = 2, ;
Height = 144, ;
Left = 192, ;
Top = 84, ;
Visible = .F., ;
Width = 157, ;
Name = "Imgcanvas7"

ADD OBJECT imgcanvas8 AS imgcanvas WITH ;
Anchor = 0, ;
Height = 144, ;
Left = 531, ;
Top = 0, ;
Visible = .F., ;
Width = 157, ;
Name = "Imgcanvas8"

ADD OBJECT imgcanvas9 AS imgcanvas WITH ;
Anchor = 0, ;
Height = 79, ;
Left = 36, ;
Top = 336, ;
Visible = .F., ;
Width = 192, ;
Name = "Imgcanvas9"

ADD OBJECT imgcanvas10 AS imgcanvas WITH ;
Anchor = 0, ;
Height = 82, ;
Left = 168, ;
Top = 236, ;
Visible = .F., ;
Width = 180, ;
Name = "Imgcanvas10"

ADD OBJECT imgcanvas11 AS imgcanvas WITH ;
Anchor = 0, ;
Stretch = 2, ;
Height = 144, ;
Left = 372, ;
Top = 288, ;
Visible = .F., ;
Width = 157, ;
Name = "Imgcanvas11"

ADD OBJECT imgcanvas12 AS imgcanvas WITH ;
Anchor = 0, ;
Height = 120, ;
Left = 540, ;
MousePointer = 15, ;
Top = 300, ;
Width = 216, ;
Name = "Imgcanvas12"

ADD OBJECT command1 AS commandbutton WITH ;
Top = 564, ;
Left = 108, ;
Height = 27, ;
Width = 84, ;
Caption = "Switch colors", ;
Name = "Command1"


ADD OBJECT imgcanvas13 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
Height = 60, ;
Left = 24, ;
MousePointer = 15, ;
Top = 456, ;
Width = 168, ;
Name = "Imgcanvas13"

ADD OBJECT imgcanvas14 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
BackStyle = 0, ;
Height = 72, ;
Left = 252, ;
MousePointer = 15, ;
Top = 336, ;
Width = 84, ;
Name = "Imgcanvas14"

ADD OBJECT imgcanvas15 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
Height = 96, ;
Left = 612, ;
MousePointer = 15, ;
Top = 168, ;
Width = 96, ;
Name = "Imgcanvas15"

ADD OBJECT imgcanvas16 AS imgcanvas WITH ;
Anchor = 15, ;
BackStyle = 0, ;
Height = 84, ;
Left = 226, ;
Top = 441, ;
Width = 459, ;
smoothingmode = 0, ;
Name = "Imgcanvas16"


ADD OBJECT imgcanvas17 AS imgcanvas WITH ;
Anchor = 15, ;
Height = 60, ;
Left = 227, ;
Top = 530, ;
Width = 456, ;
smoothingmode = 0, ;
Name = "Imgcanvas17"

ADD OBJECT imgcanvas18 AS imgcanvas WITH ;
Anchor = 15, ;
Stretch = 2, ;
Height = 72, ;
Left = 732, ;
MousePointer = 15, ;
Top = 168, ;
Width = 84, ;
Name = "Imgcanvas18"

ADD OBJECT imgcanvas19 AS imgcanvas WITH ;
Anchor = 0, ;
Height = 144, ;
Left = 696, ;
Top = 0, ;
Visible = .F., ;
Width = 181, ;
Name = "Imgcanvas19"

ADD OBJECT imgcanvas20 AS imgcanvas WITH ;
Anchor = 0, ;
Height = 144, ;
Left = 694, ;
Top = 432, ;
Visible = .F., ;
Width = 192, ;
Name = "Imgcanvas20"

PROCEDURE getpath
LPARAMETERS rc,r &&from Bernard Bout (thanks)
LOCAL x,y,w,h,xpath
x = rc.X
y = rc.Y
w = rc.Width
h = rc.Height
WITH _screen.system.Drawing
xpath = .Drawing2D.GraphicsPath.New()
xpath.AddArc(x, y, r, r, 180, 90) && Upper left corner
xpath.AddArc(x+w - r, y, r, r, 270, 90) &&Upper right corner
xpath.AddArc(x+w - r, y+h - r, r, r, 0, 90) &&Lower right corner
xpath.AddArc(x, y+h - r, r, r, 90, 90) &&Lower left corner
xpath.CloseFigure()
ENDWITH
return xpath
ENDPROC


PROCEDURE yrandom
CLEAR
gnInférieur = 1
gnSupérieur = 255
nRed1=INT((gnSupérieur - gnInférieur + 1) * RAND( ) + gnInférieur)
nGreen1=INT((gnSupérieur - gnInférieur + 1) * RAND( ) + gnInférieur)
nBlue1=INT((gnSupérieur - gnInférieur + 1) * RAND( ) + gnInférieur)
nRed2=INT((gnSupérieur - gnInférieur + 1) * RAND( ) + gnInférieur)
nGreen2=INT((gnSupérieur - gnInférieur + 1) * RAND( ) + gnInférieur)
nBlue2 =INT((gnSupérieur - gnInférieur + 1) * RAND( ) + gnInférieur)
thisform.ycolor1=rgb(nred1,ngreen1,nblue1)
thisform.ycolor2=rgb(nred2,ngreen2,nblue2)
ENDPROC

PROCEDURE Load

declare integer Sleep in win32api integer
loImgAnimator = _SCREEN.System.Drawing.ImageAnimator.New()
ADDPROPERTY(This, "IA", loImgAnimator)
ENDPROC

PROCEDURE Init
this.maxbutton=.f.
this.borderstyle=2
this.setAll("anchor",0,"imgcanvas")
this.setAll("mousepointer",15,"imgcanvas")
this.setall("drawWhenInvisible",.t.,"imgcanvas")
ENDPROC

PROCEDURE imgcanvas1.beforedraw
This.Clear
logfx=this.ogfx
WITH _screen.system.Drawing
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias
thisform.yrandom()
color1=.color.fromRGB(thisform.ycolor1)
color2=.color.fromRGB(thisform.ycolor2)

br = .drawing2d.LinearGradientBrush.New(this.Rectangle,color1,color2,1)
br.SetBlendTriangularShape(0.5,1.0)
loGFX.FillRectangle(br,this.Rectangle)
br.Dispose()

p=.pen.new(.color.fromARGB(128,.color.black),8)
logfx.drawRectangle(p,this.rectangle)

*texte
LOCAL loFont AS xfcFont
LOCAL loBrush AS xfcLinearGradientBrush
LOCAL loRectangleF As xfcRectangleF
LOCAL loSizeF AS xfcSizeF

ystring="myCaption"
loFont = .Font.New("tahoma", 12, .FontStyle.BoldItalic)
loSizeF = loGfx.MeasureString(ystring, loFont)
loRectangleF =_screen.system.Drawing.RectangleF.New((this.width-loSizeF.width)/2,(this.height-loSizeF.height)/2,loSizeF.Width, loSizeF.Height)
loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.red,.Color.white,3)
loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)
endwith
return
ENDPROC

PROCEDURE imgcanvas1.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=rgb(255,255,255)
thisform.ycolor2=rgb(0,0,255)
this.draw
ENDPROC

PROCEDURE imgcanvas1.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas1.Click
thisform.ycolor1=255
thisform.ycolor2=rgb(0,255,255)
this.draw
ENDPROC

PROCEDURE imgcanvas1.setup
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas2.setup
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas2.Click
thisform.ycolor1=255
thisform.ycolor2=rgb(0,255,255)
this.draw
ENDPROC

PROCEDURE imgcanvas2.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas2.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=rgb(255,255,255)
thisform.ycolor2=rgb(0,0,255)
this.draw
ENDPROC

PROCEDURE imgcanvas2.beforedraw
This.Clear
logfx=this.ogfx
WITH _screen.system.Drawing
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

thisform.yrandom()
color1=.color.fromRGB(thisform.ycolor1)
color2=.color.fromRGB(thisform.ycolor2)

br = .drawing2d.LinearGradientBrush.New(this.Rectangle,color1,color2,1)
br.SetBlendTriangularShape(0.5,1.0)
loGFX.FillEllipse(br,this.Rectangle)
br.Dispose()

p=.pen.new(.color.fromARGB(128,.color.white),4)
rc=.rectangle.new(4,4,this.width-8,this.height-8)
logfx.drawEllipse(p,rc)
p.dispose()

*texte
LOCAL loFont AS xfcFont
LOCAL loBrush AS xfcLinearGradientBrush
LOCAL loRectangleF As xfcRectangleF
LOCAL loSizeF AS xfcSizeF
ystring="myCaption"
loFont = .Font.New("tahoma", 12, .FontStyle.BoldItalic)
loSizeF = loGfx.MeasureString(ystring, loFont)
loRectangleF =_screen.system.Drawing.RectangleF.New((this.width-loSizeF.width)/2,(this.height-loSizeF.height)/2,loSizeF.Width, loSizeF.Height)
loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.red,.Color.white,3)
loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)

endwith
return
ENDPROC

PROCEDURE imgcanvas3.beforedraw
This.Clear
logfx=this.ogfx
WITH _screen.system.Drawing
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

thisform.yrandom()
color1=.color.fromRGB(thisform.ycolor1)
color2=.color.fromRGB(thisform.ycolor2)

br = .drawing2d.LinearGradientBrush.New(this.Rectangle,color1,color2,1)
br.SetBlendTriangularShape(0.5,1.0)
loGFX.FillEllipse(br,this.Rectangle)
br.Dispose()

p=.pen.new(.color.fromARGB(128,.color.white),4)
rc=.rectangle.new(4,4,this.width-8,this.height-8)
logfx.drawEllipse(p,rc)
p.dispose()

*texte
LOCAL loFont AS xfcFont
LOCAL loBrush AS xfcLinearGradientBrush
LOCAL loRectangleF As xfcRectangleF
LOCAL loSizeF AS xfcSizeF

ystring="myCaption"
loFont = .Font.New("tahoma", 8, .FontStyle.BoldItalic)
loSizeF = loGfx.MeasureString(ystring, loFont)
loRectangleF =_screen.system.Drawing.RectangleF.New((this.width-loSizeF.width)/2,(this.height-loSizeF.height)/2,loSizeF.Width, loSizeF.Height)
loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.red,.Color.white,3)
loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)
endwith
return
ENDPROC

PROCEDURE imgcanvas3.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=rgb(255,255,255)
thisform.ycolor2=rgb(0,0,255)
this.draw
ENDPROC

PROCEDURE imgcanvas3.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas3.Click
thisform.ycolor1=255
thisform.ycolor2=rgb(0,255,255)
this.draw
ENDPROC

PROCEDURE imgcanvas3.setup
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.height=this.width
this.draw
ENDPROC

PROCEDURE imgcanvas4.setup
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas4.Click
thisform.ycolor1=255
thisform.ycolor2=rgb(0,255,255)
this.draw
ENDPROC

PROCEDURE imgcanvas4.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas4.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=rgb(255,255,255)
thisform.ycolor2=rgb(0,0,255)
this.draw
ENDPROC

PROCEDURE imgcanvas4.beforedraw
This.Clear

logfx=this.ogfx
WITH _screen.system.Drawing
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

thisform.yrandom()
color1=.color.fromRGB(thisform.ycolor1)
color2=.color.fromRGB(thisform.ycolor2)

ypath = Thisform.GetPath(this.rectangle, 20)

br = .drawing2d.LinearGradientBrush.New(this.Rectangle,color1,color2,1)
br.SetBlendTriangularShape(0.5,1.0)
loGFX.Fillpath(br,ypath)
br.Dispose()

p=.pen.new(.color.fromARGB(128,.color.black),3)
rc=.rectangle.new(4,4,this.width-8,this.height-8)
ypath_= Thisform.GetPath(rc,20)
logfx.drawpath(p,ypath_)

*texte
LOCAL loFont AS xfcFont
LOCAL loBrush AS xfcLinearGradientBrush
LOCAL loRectangleF As xfcRectangleF
LOCAL loSizeF AS xfcSizeF

ystring="myCaption"
loFont = .Font.New("tahoma", 12, .FontStyle.BoldItalic)
loSizeF = loGfx.MeasureString(ystring, loFont)
loRectangleF =_screen.system.Drawing.RectangleF.New((this.width-loSizeF.width)/2,(this.height-loSizeF.height)/2,loSizeF.Width, loSizeF.Height)
loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.red,.Color.white,3)
loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)

endwith
return
ENDPROC

PROCEDURE imgcanvas5.setup
this.draw
ENDPROC

PROCEDURE imgcanvas5.beforedraw
Local pth As xfcGraphicsPath
Local pgb As xfcPathGradientBrush
local logfx
local w,h
a=0+3
b=0+5
w=this.width-6
h=this.height-10

This.Clear
logfx=this.ogfx
WITH _screen.system.Drawing
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias
this.clear(.color.white)

Local yPath As xfcGraphicsPath
ypath = .Drawing2D.GraphicsPath.New()
ypath.addellipse(a,b,w,h)
ypath.addellipse(a+thisform.r,b+thisform.r/2,w-2*thisform.r,h-thisform.r)

*draw rectangle
PEN = .PEN.NEW(.color.gold, 6)
loGfx.DrawPath(PEN,ypath)

Local pgb As xfcPathGradientBrush
pgb=.Drawing2d.PathGradientBrush.new(ypath)
thisform.yrandom()
pgb.centercolor=.color.fromRGB(thisform.ycolor2)
pgb.SurroundColors=.Color.Black
bl =.Drawing2d.Blend.New()
bl.Factors =_Screen.System.Single.NewArray(0,1.5) &&0.8) &&thisform.k)
bl.Positions=_Screen.System.Single.NewArray(0,1)
pgb.Blend=bl

* draw shadow
local aa
aa=5
rc2 =.Rectangle.New(2*aa,2*aa,this.width,this.height)
rc2.offset(aa,aa)
path2 = .Drawing2D.GraphicsPath.New()
path2.addellipse(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)
loGfx.FillPath(br2, path2)

loGfx.FillEllipse(pgb,a,b,w,h)
PEN = .PEN.NEW(.color.gold, 3)

loGfx.drawEllipse(pen,a+20,b+10,w-40,h-20)
pgb.Dispose()


*texte
LOCAL loFont AS xfcFont
LOCAL loBrush AS xfcLinearGradientBrush
LOCAL loRectangleF As xfcRectangleF
LOCAL loSizeF AS xfcSizeF
ystring="myCaption"
loFont = .Font.New("tahoma", 12, .FontStyle.BoldItalic)
loSizeF = loGfx.MeasureString(ystring, loFont)
loRectangleF =_screen.system.Drawing.RectangleF.New((this.width-loSizeF.width)/2,(this.height-loSizeF.height)/2,loSizeF.Width, loSizeF.Height)
loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.red,.Color.white,3)
loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)

endwith
return
ENDPROC

PROCEDURE imgcanvas5.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
w=this.width
h=this.height
for i=0 to 20
thisform.r=i
this.draw()
endfor
ENDPROC

PROCEDURE imgcanvas5.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
for i=20 to 0 step-1
thisform.r=i
this.draw
endfor
ENDPROC

PROCEDURE imgcanvas5.MouseMove
LPARAMETERS nButton, nShift, nXCoord, nYCoord
ENDPROC

PROCEDURE imgcanvas6.setup
this.addproperty("ycaption","ON")
this.draw
ENDPROC

PROCEDURE imgcanvas6.MouseMove
LPARAMETERS nButton, nShift, nXCoord, nYCoord
if between(nxCoord,this.left,this.width );
and between(nyCoord,this.top,this.height)
thisform.x=nxCoord
thisform.y=nyCoord
this.draw()
endi
ENDPROC

PROCEDURE imgcanvas6.Click
do case
case this.ycaption="ON"
this.ycaption="OFF"
case this.ycaption="OFF"
this.ycaption="ON"
endcase
this.draw
TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC

PROCEDURE imgcanvas6.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.hover=.f.
this.mousepointer=0
this.draw
ENDPROC

PROCEDURE imgcanvas6.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.hover=.t.
this.mousepointer=15
this.draw
ENDPROC

PROCEDURE imgcanvas6.beforedraw
btnOffset=50
shadowOffset=50-7
buttonFont="Arial Black"
buttonFontsize=12

thisform.yrandom()

ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
thisform.yrandom()

With _Screen.System.Drawing
* get the button colour
If Thisform.hover
buttoncolour = .Color.red
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
a=btnoffset
w=0.9*this.height -8-a
h=this.height-8-a
w=h
rc = .Rectangle.New(a,a,w, h)
path1 = .Drawing2D.GraphicsPath.New()
path1.addEllipse(rc)
br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(0,0,this.width,this.Height),buttoncolour,.Color.White,90,.t.)


delta=7
path_ = .Drawing2D.GraphicsPath.New()
rc_ = .Rectangle.New(a+delta,a+delta,w-2*delta, h-2*delta)
path_.addEllipse(rc_)
PEN = .PEN.NEW(.color.red,1)


* draw shadow
rc2 =.Rectangle.New(2*a,2*a,w,h)
rc2.offset(1.4*shadowOffset,1.4*shadowOffset)
path2 = .Drawing2D.GraphicsPath.New()
path2.addellipse(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

* draw all paths
loGfx.FillPath(br2, path2)
loGfx.FillPath(br1, path1)
loGfx.drawPath(pen, path1)
logfx.drawpath(pen,path_)
br1.dispose()
br2.dispose()

if thisform.hover=.t.
br = .SolidBrush.New(.COLOR.fromARGB(255,.color.white))
loGfx.FillEllipse(br,rc)

**effect mouseEnter
brush =.Drawing2d.PathGradientBrush.new(path1)

&&centerpoint
ypoint=.pointF.new(thisform.x,thisform.y)
brush.CenterPoint=ypoint &&bug in gdiplusX
*thisform.yset(brush.handle,ypoint) &&bug gdiplusX

brush.CenterColor=.Color.White
brush.SurroundColors(1)=.Color.Black
bl=.drawing2D.Blend.new()
bl.Factors=_screen.system.single.newArray(1,0,1)
bl.Positions=_screen.system.single.newArray(0,0.5,1)
brush.Blend=bl
loGfx.FillPath(brush, path_)
PEN = .PEN.NEW(.color.red,3)
loGfx.drawPath(pen, path_)
loGfx.drawPath(pen, path_)


else

brush =.Drawing2d.PathGradientBrush.new(path_)
brush.CenterColor = .color.fromARGB(60,.color.white)
dimension surround(1)
surround(1)=.color.green
brush.SurroundColors(1) = surround(1)
loGfx.FillPath(brush, path1)
br = .SolidBrush.New(.COLOR.fromARGB(60,.color.white))
loGfx.FillEllipse(br,rc)
endi


* draw the text
Local loBrush As xfcBrush
thisform.yrandom()
loBrush = .SolidBrush.New(.color.red) &&fromRGB(thisform.ycolor2))

Local loRect As xfcRectangle
loRect =.Rectangle.New(a,a,w, h)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(buttonFont,buttonfontsize, .FontStyle.Regular, .GraphicsUnit.Point)
* draw
loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()

ThisForm.LockScreen = .F.
Endwith
ENDPROC

PROCEDURE imgcanvas7.setup
this.addproperty("ycaption","ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",10)
this.draw
ENDPROC

PROCEDURE imgcanvas7.Click
do case
case this.ycaption="ON"
this.ycaption="OFF"
case this.ycaption="OFF"
this.ycaption="ON"
endcase
this.draw

TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC


PROCEDURE imgcanvas7.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.f.
this.mousepointer=0
this.draw
ENDPROC

PROCEDURE imgcanvas7.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.t.
this.mousepointer=15
this.draw
ENDPROC

PROCEDURE imgcanvas7.beforedraw
ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
thisform.yrandom()

With _Screen.System.Drawing
* get the button colour
If This.hover
buttoncolour = .Color.red
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
a=this.btnoffset
w=0.9*this.height -8-a
h=this.height-8-a

rc = .Rectangle.New(a,a,w, h)
path1 = .Drawing2D.GraphicsPath.New()
path1.addRectangle(rc)
br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(0,0,this.width,this.Height),buttoncolour,.Color.White,90,.t.)

delta=7
path_ = .Drawing2D.GraphicsPath.New()
rc_ = .Rectangle.New(a+delta,a+delta,w-2*delta, h-2*delta)
path_.addRectangle(rc_)
PEN = .PEN.NEW(.color.red,1)


* draw shadow
rc2 =.Rectangle.New(2*a,2*a,w,h)
rc2.offset(1.4*This.shadowOffset,1.4* This.shadowOffset)
path2 = .Drawing2D.GraphicsPath.New()
path2.addrectangle(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

* draw all paths
loGfx.FillPath(br2, path2)
loGfx.FillPath(br1, path1)
loGfx.drawPath(pen, path1)
logfx.drawpath(pen,path_)
br1.dispose()
br2.dispose()

if this.hover=.t.
br = .SolidBrush.New(.COLOR.fromARGB(255,.color.white))
loGfx.FillRectangle(br,rc)

**effect mouseEnter
brush =.Drawing2d.PathGradientBrush.new(path1)
&&centerpoint
ypoint=.pointF.new(thisform.x,thisform.y)
brush.CenterPoint=ypoint &&bug in gdiplusX

oo = .Drawing2D.GraphicsPath.New()
oo.addRectangle(rc)
ypath=.Drawing2d.PathGradientBrush.new(oo)
ypath.CenterColor=.Color.yellow
ypath.SurroundColors(1)=.Color.Black
bl=.drawing2D.Blend.new()
bl.Factors=_screen.system.single.newArray(0,1,0)
bl.Positions=_screen.system.single.newArray(0,0.5,1)
ypath.Blend=bl

loGfx.FillPath(ypath,oo)

PEN = .PEN.NEW(.color.red,3)
loGfx.drawPath(pen, path_)
loGfx.drawPath(pen, path_)

else

brush =.Drawing2d.PathGradientBrush.new(path_)
brush.CenterColor = .Color.white
dimension surround(1)
surround(1)=.color.green
brush.SurroundColors(1) = surround(1)
loGfx.FillPath(brush, path1)
endi

* draw the text
Local loBrush As xfcBrush
thisform.yrandom()
loBrush = .SolidBrush.New(.color.fromRGB(thisform.ycolor2))

Local loRect As xfcRectangle
loRect =.Rectangle.New(a,a,w, h)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(This.buttonFont,This.buttonfontsize, .FontStyle.Bold, .GraphicsUnit.Point)
* draw
loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()

ThisForm.LockScreen = .F.
Endwith
ENDPROC


PROCEDURE imgcanvas7.MouseMove
LPARAMETERS nButton, nShift, nXCoord, nYCoord
if between(nxCoord,this.left,this.width );
and between(nyCoord,this.top,this.height)
thisform.x=nxCoord
thisform.y=nyCoord
this.draw()
endi
ENDPROC

PROCEDURE imgcanvas8.setup
this.addproperty("ycaption","ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",10)
this.draw
ENDPROC

PROCEDURE imgcanvas8.Click
do case
case this.ycaption="ON"
this.ycaption="OFF"
case this.ycaption="OFF"
this.ycaption="ON"
endcase
this.draw

TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC


PROCEDURE imgcanvas8.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.f.
this.mousepointer=0
this.draw
ENDPROC

PROCEDURE imgcanvas8.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.t.
this.mousepointer=15
this.draw
ENDPROC

PROCEDURE imgcanvas8.beforedraw
ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
thisform.yrandom()

With _Screen.System.Drawing
* get the button colour
If This.hover
buttoncolour = .Color.red
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
a=this.btnoffset
w=0.9*this.height -8-a
h=this.height-8-a

rc = .Rectangle.New(a,a,w, h)
path1 = .Drawing2D.GraphicsPath.New()
path1.addEllipse(rc)
br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(0,0,this.width,this.Height),buttoncolour,.Color.White,90,.t.)


delta=7
path_ = .Drawing2D.GraphicsPath.New()
rc_ = .Rectangle.New(a+delta,a+delta,w-2*delta, h-2*delta)
path_.addEllipse(rc_)
PEN = .PEN.NEW(.color.red,1)

* draw shadow
rc2 =.Rectangle.New(2*a,2*a,w,h)
rc2.offset(1.4*This.shadowOffset,1.4* This.shadowOffset)
path2 = .Drawing2D.GraphicsPath.New()
path2.addellipse(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

* draw all paths
loGfx.FillPath(br2, path2)
loGfx.FillPath(br1, path1)
loGfx.drawPath(pen, path1)
logfx.drawpath(pen,path_)
br1.dispose()
br2.dispose()

if thisform.hover=.t.
**effect mouseEnter
brush =.Drawing2d.PathGradientBrush.new(path1)
brush.CenterColor = .Color.gold
dimension surround(1)
surround(1)=.color.blue
brush.SurroundColors(1) = surround(1)

loGfx.FillPath(brush, path1)

PEN = .PEN.NEW(.color.red,2)
loGfx.drawPath(pen, path_)
loGfx.drawPath(pen, path_)

else

brush =.Drawing2d.PathGradientBrush.new(path_)
brush.CenterColor = .Color.white
dimension surround(1)
surround(1)=.color.green
brush.SurroundColors(1) = surround(1)
loGfx.FillPath(brush, path1)
endi


* draw the text
Local loBrush As xfcBrush
thisform.yrandom()
loBrush = .SolidBrush.New(.color.fromRGB(thisform.ycolor2))

Local loRect As xfcRectangle
loRect =.Rectangle.New(a,a,w, h)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(This.buttonFont,This.buttonfontsize, .FontStyle.Bold, .GraphicsUnit.Point)
* draw

loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()

ThisForm.LockScreen = .F.
Endwith
ENDPROC

PROCEDURE imgcanvas9.Click
TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC


PROCEDURE imgcanvas9.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.f.
this.mousepointer=0
this.draw
ENDPROC


PROCEDURE imgcanvas9.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.t.
this.mousepointer=15
this.draw
ENDPROC

PROCEDURE imgcanvas9.beforedraw
ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
thisform.yrandom()

With _Screen.System.Drawing
* get the button colour
If This.hover
buttoncolour = .Color.Gold
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
rc = .Rectangle.New(This.btnOffset,This.btnOffset,This.Width-8-This.btnOffset, This.Height-8-This.btnOffset)
path1 = .Drawing2D.GraphicsPath.New()
path1.addEllipse(rc)
br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(0,0,this.Width,this.Height),buttoncolour,.Color.White,90,.t.)

* draw shadow
rc2 = rc
rc2.offset(This.shadowOffset, This.shadowOffset)
path2 = .Drawing2D.GraphicsPath.New()
path2.addellipse(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

*Create top water color to give "aqua" effect
rc3 = .Rectangle.New(This.btnOffset,This.btnOffset,this.Width-8-This.btnOffset, this.Height-8-This.btnOffset)
rc3.Inflate(-10,-10)
rc3.Height = 30
path3 = .Drawing2D.GraphicsPath.New()
path3.addellipse(rc3)
br3 = .Drawing2D.LinearGradientBrush.New(rc3,.Color.FromArgb(255, .Color.White),;
.Color.FromArgb(0, .Color.White), .Drawing2D.LinearGradientMode.Vertical)


* draw all images in ascending sequence
loGfx.FillPath(br2, path2) && shadow
loGfx.FillPath(br1, path1) && button
loGfx.FillPath(br3, path3) && aqua effect
br1.dispose()
br2.dispose()
br3.dispose()
* draw the text
Local loBrush As xfcBrush
thisform.yrandom()
loBrush = .SolidBrush.New(.color.fromRGB(thisform.ycolor2))

Local loRect As xfcRectangle
loRect = .Rectangle.New(this.btnoffSet,this.btnoffSet, This.Width-this.btnoffSet-5, This.Height-this.btnOffset-5)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(This.buttonFont,This.buttonfontsize, .FontStyle.Bold, .GraphicsUnit.Point)
* draw it
loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()
ThisForm.LockScreen = .F.
Endwith
ENDPROC

PROCEDURE imgcanvas9.setup
this.addproperty("ycaption","ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",10)
this.draw
ENDPROC

PROCEDURE imgcanvas10.Click
TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC


PROCEDURE imgcanvas10.beforedraw
ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
thisform.yrandom()
With _Screen.System.Drawing
* get the button colour
If This.hover
buttoncolour = .Color.Gold
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
rc = .Rectangle.New(This.btnoffset,This. btnoffset,This.Width-8-This. btnoffset, This.Height-8-This. btnoffset)
path1 = Thisform.GetPath(rc, 20)

br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(this.left,this.top,this.Width,this.Height),buttoncolour,.Color.White,90,.t.)


* draw shadow
rc2 = rc
rc2.offset(This.shadowOffset,This.shadowOffset)
path2 = Thisform.GetPath(rc2, 20)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

*Create top water color to give "aqua" effect
rc3 = .Rectangle.New(This. btnoffset,This. btnoffset,this.Width-8-This. btnoffset, this.Height-8-This. btnoffset)
rc3.Inflate(-5,-5)
rc3.Height = 15
path3 = Thisform.GetPath(rc3, 20)
br3 = .Drawing2D.LinearGradientBrush.New(rc3,.Color.FromArgb(255, .Color.White),;
.Color.FromArgb(0, .Color.White), .Drawing2D.LinearGradientMode.Vertical)


* draw all images in ascending sequence
loGfx.FillPath(br2, path2) && shadow
loGfx.FillPath(br1, path1) && button
loGfx.FillPath(br3, path3) && aqua effect
br1.dispose()
br2.dispose()
br3.dispose()
* draw the text
Local loBrush As xfcBrush
thisform.yrandom()
loBrush = .SolidBrush.New(.color.fromRGB(thisform.ycolor2))

Local loRect As xfcRectangle
loRect = .Rectangle.New(this. btnoffset,this. btnoffset, This.Width-this. btnoffset-5, This.Height-this. btnoffset-5)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(This.buttonFont,This.buttonfontsize, .FontStyle.Bold, .GraphicsUnit.Point)
* draw
loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()
Endwith
ThisForm.LockScreen = .F.
ENDPROC


PROCEDURE imgcanvas10.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.t.
this.mousepointer=15
this.draw
ENDPROC


PROCEDURE imgcanvas10.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.f.
this.mousepointer=0
this.draw
ENDPROC

PROCEDURE imgcanvas10.setup
this.addproperty("ycaption","ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",10)
this.draw
ENDPROC

PROCEDURE imgcanvas11.beforedraw
ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
thisform.yrandom()

With _Screen.System.Drawing
* get the button colour
If This.hover
buttoncolour = .Color.red
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
a=this.btnoffset
w=0.9*this.height -8-a
h=this.height-8-a
w=h
rc = .Rectangle.New(a,a,w, h)
path1 = .Drawing2D.GraphicsPath.New()
path1.addEllipse(rc)
br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(0,0,this.width,this.Height),buttoncolour,.Color.White,90,.t.)

delta=7
path_ = .Drawing2D.GraphicsPath.New()
rc_ = .Rectangle.New(a+delta,a+delta,w-2*delta, h-2*delta)
path_.addEllipse(rc_)
PEN = .PEN.NEW(.color.red,1)

* draw shadow
rc2 =.Rectangle.New(2*a,2*a,w,h)
rc2.offset(1.4*This.shadowOffset,1.4* This.shadowOffset)
path2 = .Drawing2D.GraphicsPath.New()
path2.addellipse(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

* draw all paths
loGfx.FillPath(br2, path2)
loGfx.FillPath(br1, path1)
loGfx.drawPath(pen, path1)
logfx.drawpath(pen,path_)
br1.dispose()
br2.dispose()

if this.hover=.t.
br = .SolidBrush.New(.COLOR.fromARGB(255,.color.white))
loGfx.FillEllipse(br,rc)

**effect mouseEnter
brush =.Drawing2d.PathGradientBrush.new(path1)

&&centerpoint
ypoint=.pointF.new(thisform.x,thisform.y)
brush.CenterPoint=ypoint &&bug in gdiplusX

brush.CenterColor=.Color.White
brush.SurroundColors(1)=.Color.Black
bl=.drawing2D.Blend.new()
bl.Factors=_screen.system.single.newArray(1,0,1)
bl.Positions=_screen.system.single.newArray(0,0.5,1)
brush.Blend=bl
loGfx.FillPath(brush, path_)
PEN = .PEN.NEW(.color.red,3)
loGfx.drawPath(pen, path_)
loGfx.drawPath(pen, path_)


else

brush =.Drawing2d.PathGradientBrush.new(path_)
brush.CenterColor = .color.fromARGB(60,.color.white)
dimension surround(1)
surround(1)=.color.blue
brush.SurroundColors(1) = surround(1)
loGfx.FillPath(brush, path1)
br = .SolidBrush.New(.COLOR.fromARGB(60,.color.white))
loGfx.FillEllipse(br,rc)
endi


* draw the text
Local loBrush As xfcBrush
thisform.yrandom()
loBrush = .SolidBrush.New(.color.fromRGB(thisform.ycolor2))

Local loRect As xfcRectangle
loRect =.Rectangle.New(a,a,w, h)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(This.buttonFont,This.buttonfontsize, .FontStyle.Regular, .GraphicsUnit.Point)
* draw it
loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()

ThisForm.LockScreen = .F.
Endwith
ENDPROC

PROCEDURE imgcanvas11.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.t.
this.mousepointer=15
this.draw
ENDPROC

PROCEDURE imgcanvas11.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.f.
this.mousepointer=0
this.draw
ENDPROC

PROCEDURE imgcanvas11.Click
do case
case this.ycaption="ON"
this.ycaption="OFF"
case this.ycaption="OFF"
this.ycaption="ON"
endcase
this.draw

TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC

PROCEDURE imgcanvas11.MouseMove
LPARAMETERS nButton, nShift, nXCoord, nYCoord
if between(nxCoord,this.left,this.width );
and between(nyCoord,this.top,this.height)
thisform.x=nxCoord
thisform.y=nyCoord
this.draw()
endi
ENDPROC

PROCEDURE imgcanvas11.setup
this.addproperty("ycaption","ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",10)
this.draw
ENDPROC

PROCEDURE imgcanvas12.setup
this.addproperty("ycaption","ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",10)
this.addproperty("k",0)
this.draw
ENDPROC

PROCEDURE imgcanvas12.beforedraw
Local pth As xfcGraphicsPath
Local pgb As xfcPathGradientBrush
local logfx
local w,h
a=0+3
b=0+5
w=this.width-6
h=this.height-10

This.Clear
logfx=this.ogfx
WITH _screen.system.Drawing
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias
this.clear(.color.white)


Local yPath As xfcGraphicsPath
ypath = .Drawing2D.GraphicsPath.New()
ypath.addellipse(a,b,w,h)
ypath.CloseFigure()

*draw rectangle
PEN = .PEN.NEW(.color.gold, 6)
loGfx.DrawPath(PEN,ypath)

Local pgb As xfcPathGradientBrush
pgb=.Drawing2d.PathGradientBrush.new(ypath)
thisform.yrandom()
pgb.SurroundColors[1] = .color.fromRGB(thisform.ycolor1)
pgb.centercolor=.color.fromRGB(thisform.ycolor2)
pgb.SurroundColors=.Color.Black
bl =.Drawing2d.Blend.New()

bl.Factors =_Screen.System.Single.NewArray(0,this.k)
bl.Positions=_Screen.System.Single.NewArray(0,1)
pgb.Blend=bl

ypoint=.pointF.new(thisform.x,thisform.y)

pgb.CenterPoint=ypoint &&bug in gdiplusX

loGfx.FillEllipse(pgb,a,b,w,h)
PEN = .PEN.NEW(.color.white, 3)
loGfx.drawEllipse(pen,a+20,b+10,w-40,h-20)
pgb.Dispose()

*texte
LOCAL loFont AS xfcFont
LOCAL loBrush AS xfcLinearGradientBrush
LOCAL loRectangleF As xfcRectangleF
LOCAL loSizeF AS xfcSizeF
ystring="myCaption"
loFont = .Font.New("tahoma", 12, .FontStyle.BoldItalic)
loSizeF = loGfx.MeasureString(ystring, loFont)
loRectangleF =_screen.system.Drawing.RectangleF.New((this.width-loSizeF.width)/2,(this.height-loSizeF.height)/2,loSizeF.Width, loSizeF.Height)
loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.red,.Color.white,3)
loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)

endwith
return
ENDPROC

PROCEDURE imgcanvas12.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord

for this.k=0 to 1 step 0.1
this.draw()
endfor
ENDPROC

PROCEDURE imgcanvas12.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
for this.k= 1 to 0 step -0.1
this.draw()
sleep(50)
endfor

this.k=0
ENDPROC

PROCEDURE imgcanvas12.MouseMove
LPARAMETERS nButton, nShift, nXCoord, nYCoord
if between(nxCoord,this.left,this.left+this.width );
and between(nyCoord,this.top,this.top+this.height)
thisform.x=nxCoord-this.left
thisform.y=nyCoord-this.top
this.draw()
endi
ENDPROC

PROCEDURE command1.Click
for i=1 to thisform.controlcount
try
ys="thisform.imgcanvas"+allt(str(i))+".draw"
&ys
catch to exception
endtry
endfor
ENDPROC

PROCEDURE imgcanvas13.setup
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC

PROCEDURE imgcanvas13.Click
thisform.ycolor1=255
thisform.ycolor2=rgb(0,255,255)
this.draw
ENDPROC

PROCEDURE imgcanvas13.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=0
thisform.ycolor2=rgb(0,255,0)
this.draw
ENDPROC


PROCEDURE imgcanvas13.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.ycolor1=rgb(255,255,255)
thisform.ycolor2=rgb(0,0,255)
this.draw
ENDPROC

PROCEDURE imgcanvas13.beforedraw
This.Clear

logfx=this.ogfx
WITH _screen.system.Drawing
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

thisform.yrandom()

color1=.color.fromRGB(thisform.ycolor1)
color2=.color.fromRGB(thisform.ycolor2)

br = .drawing2d.LinearGradientBrush.New(This.Rectangle,color1,COLOR2,1,.f.)
bl=.Drawing2d.Blend.New()
bl.Factors = _Screen.System.Single.NewArray(0,0.1,0.5,0.7,1.0,0,1.0,0.5,0.3,0.2,0)
bl.Positions = _Screen.System.Single.NewArray(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0)
br.Blend=bl

loGFX.FillRectangle(br,this.Rectangle)
br.Dispose()

p=.pen.new(.color.fromARGB(128,.color.red),8)
logfx.drawRectangle(p,this.rectangle)

*texte
LOCAL loFont AS xfcFont
LOCAL loBrush AS xfcLinearGradientBrush
LOCAL loRectangleF As xfcRectangleF
LOCAL loSizeF AS xfcSizeF
ystring="myCaption"
loFont = .Font.New("tahoma", 12, .FontStyle.BoldItalic)
loSizeF = loGfx.MeasureString(ystring, loFont)
loRectangleF =_screen.system.Drawing.RectangleF.New((this.width-loSizeF.width)/2,(this.height-loSizeF.height)/2,loSizeF.Width, loSizeF.Height)
loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.red,.Color.white,3)
loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)

endwith
return
ENDPROC

PROCEDURE imgcanvas14.setup
this.addProperty("cfilename","spinny.gif")
this.addProperty("oImage","")
this.addProperty("cas",0)

this.picture="play.png"
ENDPROC


PROCEDURE imgcanvas14.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
ThisForm.IA.StopAnimate(This.oImage)

this.picture="play.png"
ENDPROC

PROCEDURE imgcanvas14.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
LOCAL loImgAnimator AS xfcImageAnimator
WITH _SCREEN.System
** Stop any existing animations
ThisForm.IA.StopAnimate(This.oImage)

** Load the image object
This.oImage = .Drawing.Image.FromFile(This.cFileName)

** Create an EventHandler using the Draw method
loEventHandler = .EventHandler.New(This, "Draw")

** Animate the image
ThisForm.IA.Animate(This.oImage, loEventHandler)
ENDWITH

ENDPROC

PROCEDURE imgcanvas14.draw
LPARAMETERS toSource as xfcImage, toArgs
IF VARTYPE(m.toSource) = "O"
This.Clear()

** Update the GIF frame
ThisForm.IA.UpdateFrames(m.toSource)
** Draw the image on the canvas
This.oGfx.DrawImage(m.toSource, 0,0)

ENDIF
DODEFAULT()
ENDPROC

PROCEDURE imgcanvas14.afterdraw
if this.cas=0
this.cas=1
this.picture="play.png"
endi
ENDPROC

PROCEDURE imgcanvas15.draw
LPARAMETERS toSource as xfcImage, toArgs
IF VARTYPE(m.toSource) = "O"
This.Clear()
** Update the GIF frame
ThisForm.IA.UpdateFrames(m.toSource)
** Draw the image on the canvas
This.oGfx.DrawImage(m.toSource, 0,0)

ENDIF

DODEFAULT()

ENDPROC


PROCEDURE imgcanvas15.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord

LOCAL loImgAnimator AS xfcImageAnimator

WITH _SCREEN.System
** Stop any existing animations
ThisForm.IA.StopAnimate(This.oImage)

** Load the image object
This.oImage = .Drawing.Image.FromFile(This.cFileName)

** Create an EventHandler using the Draw method
loEventHandler = .EventHandler.New(This, "Draw")

** Animate the image
ThisForm.IA.Animate(This.oImage, loEventHandler)
ENDWITH

ENDPROC

PROCEDURE imgcanvas15.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
ThisForm.IA.StopAnimate(This.oImage)

this.picture="star.png"
ENDPROC

PROCEDURE imgcanvas15.setup
this.addProperty("cfilename","motor.gif")
this.addProperty("oImage","")
this.addProperty("cas",0)
this.picture="star.png"
this.draw
ENDPROC


PROCEDURE imgcanvas15.afterdraw
if this.cas=0
this.cas=1
this.picture="star.png"
endi
ENDPROC

PROCEDURE imgcanvas16.setup
this.draw
ENDPROC


PROCEDURE imgcanvas16.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.draw
ENDPROC

PROCEDURE imgcanvas16.beforedraw
LOCAL lcStyle
lcStyle = "B"
xtext="MouseMove on all buttons"
xfontName="Arial Black"
xsize=28
thisform.yrandom()
xcolormain=thisform.ycolor1 &&rgb(0,255,0)
xcolorShadow=0
LOCAL loFont AS xfcFont

WITH _SCREEN.SYSTEM.Drawing
This.Clear()


DO CASE
CASE lcStyle == "B"
loStyle = .FontStyle.Bold
CASE lcStyle == "I"
loStyle = .FontStyle.Italic
CASE lcStyle == "BI"
loStyle = .FontStyle.BoldItalic
OTHERWISE
loStyle = .FontStyle.Regular
ENDCASE

* Create a bitmap in a fixed ratio to the original drawing area.
LOCAL loBmp as xfcBitmap
loBmp = .Bitmap.New(This.Width / 5, This.Height / 5)

* Create a GraphicsPath object.
LOCAL loPath as xfcGraphicsPath
loPath = .Drawing2D.GraphicsPath.New()

* Add the string in the chosen style.
loPath.AddString(xText, ;
.FontFamily.New(xfontname), ;
loStyle, ;
xsize, ;
.Point.New(0, 0), ;
.StringFormat.GenericTypographic)

* Get the graphics object for the image.
LOCAL loGfx as xfcGraphics
loGfx = .Graphics.FromImage(loBmp)
loGfx.clear(.color.white)
* Create a matrix that shrinks the drawing output by the fixed ratio.
LOCAL loMatrix as xfcMatrix
loMatrix = .Drawing2D.Matrix.New(1/5, 0, 0, 1/5, -1/5, -1/5)

* Choose an appropriate smoothing mode for the halo.
loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* Transform the graphics object so that the same half may be used for both halo and text output.
loGfx.Transform = loMatrix

* Using a suitable pen...
LOCAL loPen as xfcPen
loPen = .Pen.New(.Color.FromRGB(xcolorShadow))

* Draw around the outline of the path
loGfx.DrawPath(loPen, loPath)

* and then fill in for good measure.
loGfx.FillPath( .SolidBrush.New(.Color.FromRGB(xcolorShadow)), loPath)

* setup the smoothing mode for path drawing
This.oGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* and the interpolation mode for the expansion of the halo bitmap
This.oGfx.InterpolationMode = .Drawing2D.InterpolationMode.HighQualityBicubic

* expand the halo making the edges nice and fuzzy.
This.oGfx.DrawImage(loBmp, This.Rectangle, 0, 0, ;
loBmp.Width, loBmp.Height, .GraphicsUnit.Pixel)

* Redraw the original text
This.oGfx.FillPath(.SolidBrush.New(.Color.FromRGB(xcolormain)), loPath)
ENDWITH
RETURN
ENDPROC

PROCEDURE imgcanvas17.setup
this.draw
ENDPROC

PROCEDURE imgcanvas17.beforedraw
LOCAL lcStyle,lnShear
lcStyle="B"
xfont="Arial Black"
xsize=24
thisform.yrandom()
xbackcolor1=thisform.ycolor1
xbackcolor2=thisform.ycolor2 &&rgb(0,22,0)
xtext="GdiplusX is cool !"
lnShear =1.00
*!* http://www.codeguru.com/cpp/g-m/gdi/gdi/article.php/c8703__2/

LOCAL loFont AS xfcFont
LOCAL loFontFamily AS xfcFontFamily
LOCAL loMatrix AS xfcMatrix

WITH _SCREEN.SYSTEM.Drawing
This.Clear()

DO CASE
CASE lcStyle == "B"
loStyle = .FontStyle.Bold
CASE lcStyle == "I"
loStyle = .FontStyle.Italic
CASE lcStyle == "BI"
loStyle = .FontStyle.BoldItalic
OTHERWISE
loStyle = .FontStyle.Regular
ENDCASE

loFont = .Font.New(xfont ,xSize, loStyle)
loFontFamily = .FontFamily.New(xfont)

This.oGfx.DrawString(xtext, loFont, ;
.SolidBrush.New(.Color.FromRGB(xBackColor1)), ;
This.Rectangle)

LOCAL lnCy, lnLineHeight, lnLineAscent, lnLineSpacing
lnLineAscent = loFontFamily.GetCellAscent(loStyle)
lnLineSpacing = loFontFamily.GetLineSpacing(loStyle)
lnLineHeight = loFont.GetHeight(This.oGfx)
lnCy = lnLineHeight * lnLineAscent / lnLineSpacing

*lnShear = Thisform.Spinner3.Value
loMatrix = .Drawing2D.Matrix.New()
loMatrix.Shear(lnShear, 0)
loMatrix.Scale(1, -1)

This.oGfx.MultiplyTransform(loMatrix)

This.oGfx.DrawString(xtext, loFont, ;
.SolidBrush.New(.Color.FromRGB(xBackColor2)), ;
.PointF.New(0 + (-0.82 * lnLineHeight * lnShear) , -(lnCy*2)-1))

This.oGfx.ResetTransform()

ENDWITH
RETURN
ENDPROC

PROCEDURE imgcanvas17.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.yrandom()
this.draw
ENDPROC

PROCEDURE imgcanvas18.draw

LPARAMETERS toSource as xfcImage, toArgs
IF VARTYPE(m.toSource) = "O"
This.Clear()

** Update the GIF frame
ThisForm.IA.UpdateFrames(m.toSource)
** Draw the image on the canvas
This.oGfx.DrawImage(m.toSource, 0,0)

ENDIF

DODEFAULT()
ENDPROC


PROCEDURE imgcanvas18.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord



ENDPROC

PROCEDURE imgcanvas18.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
ENDPROC


PROCEDURE imgcanvas18.setup
this.addProperty("cfilename","star.gif")
this.addProperty("oImage","")

LOCAL loImgAnimator AS xfcImageAnimator

WITH _SCREEN.System
** Stop any existing animations
ThisForm.IA.StopAnimate(This.oImage)

** Load the image object
This.oImage = .Drawing.Image.FromFile(This.cFileName)

** Create an EventHandler using the Draw method
loEventHandler = .EventHandler.New(This, "Draw")

** Animate the image
ThisForm.IA.Animate(This.oImage, loEventHandler)
ENDWITH

ENDPROC


PROCEDURE imgcanvas19.beforedraw
ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
*thisform.yrandom()
thisform.ycolor1=rgb(255,255,255)
thisform.ycolor2=rgb(0,255,0)

With _Screen.System.Drawing
* get the button colour
If This.hover
buttoncolour = .Color.red
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
a=this.btnoffset
w=0.9*this.height -8-a
h=this.height-8-a

rc = .Rectangle.New(a,a,w, h)
path1 = .Drawing2D.GraphicsPath.New()
path1.addEllipse(rc)
br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(0,0,this.width,this.Height),buttoncolour,.Color.White,90,.t.)

delta=7
path_ = .Drawing2D.GraphicsPath.New()
rc_ = .Rectangle.New(a+delta,a+delta,w-2*delta, h-2*delta)
path_.addEllipse(rc_)
PEN = .PEN.NEW(.color.red,1)

* draw shadow
rc2 =.Rectangle.New(2*a,2*a,w,h)
rc2.offset(1.4*This.shadowOffset,1.4* This.shadowOffset)
path2 = .Drawing2D.GraphicsPath.New()
path2.addellipse(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

* draw all paths
loGfx.FillPath(br2, path2)
loGfx.FillPath(br1, path1)
loGfx.drawPath(pen, path1)
logfx.drawpath(pen,path_)
br1.dispose()
br2.dispose()

if this.hover=.t.
**effect mouseEnter
brush =.Drawing2d.PathGradientBrush.new(path1)
brush.CenterColor = .Color.gold
dimension surround(1)
surround(1)=.color.blue
brush.SurroundColors(1) = surround(1)

loGfx.FillPath(brush, path1)

PEN = .PEN.NEW(.color.red,2)
loGfx.drawPath(pen, path_)
loGfx.drawEllipse(pen, rc)

else

brush =.Drawing2d.PathGradientBrush.new(path_)
brush.CenterColor = .Color.white
dimension surround(1)
surround(1)=.color.maroon
brush.SurroundColors(1) = surround(1)
loGfx.FillPath(brush, path1)
endi

* draw the text
Local loBrush As xfcBrush
loBrush = .SolidBrush.New(.color.fromRGB(thisform.ycolor2))

Local loRect As xfcRectangle
loRect =.Rectangle.New(a,a,w, h)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(This.buttonFont,This.buttonfontsize, .FontStyle.Bold, .GraphicsUnit.Point)
* draw it

loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()

ThisForm.LockScreen = .F.
Endwith
ENDPROC


PROCEDURE imgcanvas19.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.t.
this.mousepointer=15
this.draw
ENDPROC


PROCEDURE imgcanvas19.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.f.
this.mousepointer=0
this.draw
ENDPROC


PROCEDURE imgcanvas19.Click
do case
case this.ycaption="myCaption ON"
this.ycaption="myCaption OFF"
case this.ycaption="myCaption OFF"
this.ycaption="myCaption ON"
endcase
this.draw

TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC


PROCEDURE imgcanvas19.setup
this.addproperty("ycaption","myCaption ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",9)
this.draw
ENDPROC


PROCEDURE imgcanvas20.setup
this.addproperty("ycaption","myCaption ON")
this.addproperty("hover",.f.)
this.addproperty("btnoffset",5)
this.addproperty("shadowOffset",5)
this.addproperty("buttonFont","Arial")
this.addproperty("buttonFontSize",9)
this.draw
ENDPROC


PROCEDURE imgcanvas20.Click
do case
case this.ycaption="ON"
this.ycaption="OFF"
case this.ycaption="OFF"
this.ycaption="ON"
endcase
this.draw

TRY
LOCAL lcBell
lcBell = SET("Bell")
SET BELL TO (ADDBS(GETENV('windir')))+"MEDIA\notify.WAV"
?? CHR(7)
SET BELL TO (lcBell)
CATCH
ENDTRY
ENDPROC


PROCEDURE imgcanvas20.MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.f.
this.mousepointer=0
this.draw
ENDPROC


PROCEDURE imgcanvas20.MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.hover=.t.
this.mousepointer=15
this.draw
ENDPROC


PROCEDURE imgcanvas20.beforedraw
ThisForm.LockScreen = .T.
This.Visible = .T.
Local path4 As xfcGraphicsPath
Local loFont As xfcFont
Local strformat As xfcStringFormat
Local loGfx As xfcGraphics
loGfx = This.oGfx
Local buttoncolour
Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3

thisform.ycolor1=rgb(255,255,255)
thisform.ycolor2=rgb(0,255,0)

With _Screen.System.Drawing
* get the button colour
If This.hover
buttoncolour = .Color.green
buttonfontcolour = .Color.Black
Else
buttoncolour = .Color.FromRGB(thisform.ycolor1)
buttonfontcolour = .Color.FromRGB(thisform.ycolor2)
Endif

loGfx.Clear(.Color.FromRGB(This.Parent.BackColor))

loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

* draw button
a=this.btnoffset
w=0.9*this.height -8-a
h=this.height-8-a

rc = .Rectangle.New(a,a,w, h)
path1 = .Drawing2D.GraphicsPath.New()
path1.addEllipse(rc)
br1 = .Drawing2D.LinearGradientBrush.New(.rectangle.new(0,0,this.width,this.Height),buttoncolour,.Color.White,90,.t.)

delta=7
path_ = .Drawing2D.GraphicsPath.New()
rc_ = .Rectangle.New(a+delta,a+delta,w-2*delta, h-2*delta)
path_.addEllipse(rc_)
PEN = .PEN.NEW(.color.red,1)


* draw shadow
rc2 =.Rectangle.New(2*a,2*a,w,h)
rc2.offset(1.4*This.shadowOffset,1.4* This.shadowOffset)
path2 = .Drawing2D.GraphicsPath.New()
path2.addellipse(rc2)
br2 = .Drawing2D.PathGradientBrush.New(path2)
br2.CenterColor = .Color.Black
br2.SurroundColors = .Color.FromRGB(This.parent.BackColor)

* draw all paths
loGfx.FillPath(br2, path2)
loGfx.FillPath(br1, path1)

loGfx.drawPath(pen, path1)
logfx.drawpath(pen,path_)


br1.dispose()
br2.dispose()

if this.hover=.t.
**effect mouseEnter
path1.addpath(path_)
brush =.Drawing2d.PathGradientBrush.new(path1)
brush.CenterColor = .Color.gold
dimension surround(2)
surround(1)=.color.blue
surround(1)=.color.red
brush.SurroundColors(1) = surround(1)
brush.SurroundColors(2) = surround(2)
loGfx.FillPath(brush, path1)
PEN = .PEN.NEW(.color.blue,2)
loGfx.drawPath(pen, path_)
loGfx.drawEllipse(pen, rc)


else

brush =.Drawing2d.PathGradientBrush.new(path_)
brush.CenterColor = .Color.white
dimension surround(1)
surround(1)=.color.green
brush.SurroundColors(1) = surround(1)
loGfx.FillPath(brush, path1)
endi


* draw the text
Local loBrush As xfcBrush
*thisform.yrandom()
loBrush = .SolidBrush.New(.color.red)

Local loRect As xfcRectangle
loRect =.Rectangle.New(a,a,w, h)
* Get a basic string format object, then set properties
Local loStringFormat As xfcStringFormat
loStringFormat = .StringFormat.New()
loStringFormat.Alignment = .StringAlignment.Center
loStringFormat.LineAlignment =.StringAlignment.Center

* Create a Font object
Local loFont As xfcFont
loFont = .Font.New(This.buttonFont,This.buttonfontsize, .FontStyle.Bold, .GraphicsUnit.Point)
* draw it
loGfx.DrawString(this.yCaption ,loFont, loBrush, loRect, loStringFormat)
loBrush.dispose()

ThisForm.LockScreen = .F.
Endwith
ENDPROC
PROCEDURE DESTROY
CLEA EVENTS
ENDPROC


ENDDEFINE
*

*EndCode

these images are used by the code above.download them in same location with code source .
these images are used by the code above.download them in same location with code source .
these images are used by the code above.download them in same location with code source .
these images are used by the code above.download them in same location with code source .
these images are used by the code above.download them in same location with code source .
these images are used by the code above.download them in same location with code source .

these images are used by the code above.download them in same location with code source .

2 screen shots -can reset new random colors with button embed.
2 screen shots -can reset new random colors with button embed.

2 screen shots -can reset new random colors with button embed.

*ChapII-Gradientbrushes in many styles and many colors

 

*subject:a small sample giving the drawing of gradientbrushes in many styles and many colors.
*--GdiplusX samples: Linear gradientBrushes - colors.

*begin code
Do Locfile("system.app","app")
Set Classlib To Locfile('gdiplusX','vcx') AddI
yform=Createobject("ygradients")
yform.Show
Release Classlib gdiplusX
Read Events
Return

Define Class ygradients As Form
    Height = 633
    Width = 523
    ShowWindow = 2
    AutoCenter = .T.
    BorderStyle = 2
    Caption = "LinearGradientBrush sample"
    MaxButton = .F.
    BackColor = Rgb(0,0,0)
    ycolor1 = 255
    ycolor2 = 1254
    nmode = 0
    Over = .F.
    cas = 0
    btnoffset = 3
    shadowoffset = 2
    buttonfont = "Arial"
    buttonfontsize = 12
    ocaption = "Swith colors"
    Name = "FORM1"

    Add Object imgcanvas1 As imgcanvas With ;
        Anchor = 15, ;
        Height = 575, ;
        Left = 1, ;
        MousePointer = 15, ;
        Top = 1, ;
        Width = 540, ;
        Name = "Imgcanvas1"

    Add Object imgcanvas2 As imgcanvas With ;
        Anchor = 0, ;
        Height = 72, ;
        Left = 150, ;
        Top = 578, ;
        Width = 157, ;
        Name = "Imgcanvas2"

    Procedure yrandom
        Clear
        gnInférieur = 1
        gnSupérieur = 255
        nRed1=Int((gnSupérieur - gnInférieur + 1) * Rand( ) + gnInférieur)
        nGreen1=Int((gnSupérieur - gnInférieur + 1) * Rand( ) + gnInférieur)
        nBlue1=Int((gnSupérieur - gnInférieur + 1) * Rand( ) + gnInférieur)

        nRed2=Int((gnSupérieur - gnInférieur + 1) * Rand( ) + gnInférieur)
        nGreen2=Int((gnSupérieur - gnInférieur + 1) * Rand( ) + gnInférieur)
        nBlue2 =Int((gnSupérieur - gnInférieur + 1) * Rand( ) + gnInférieur)
        Thisform.ycolor1=Rgb(nRed1,nGreen1,nBlue1)
        Thisform.ycolor2=Rgb(nRed2,nGreen2,nBlue2)
    Endproc

    Procedure Destroy
        Clea Events
    Endproc

    Procedure Resize
        This.imgcanvas2.Top=This.Height-This.imgcanvas2.Height-5
        This.imgcanvas2.Left=(This.Width-This.imgcanvas2.Width)/2
    Endproc

    Procedure imgcanvas1.beforedraw
        Local loGfx As xfcGraphics
        loGfx=This.ogfx
        With _Screen.System.Drawing
            loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias
            This.Clear(.Color.black)

            Local yPath As xfcGraphicsPath
            xw=500
            xh=120
            h=0
            For i=1 To 4
                Thisform.yrandom()
                color1=.Color.fromRGB(Thisform.ycolor1)
                color2=.Color.fromRGB(Thisform.ycolor2)
                Rect=.Rectangle.new(10, 10+h, xw, xh)

                Do Case
                    Case i=1
                        br = .Drawing2D.LinearGradientBrush.new(.Point.new(10,10), .Point.new(50,50),color1,color2,Thisform.nmode)
                    Case i=2
                        br = .Drawing2D.LinearGradientBrush.new(.Point.new(10,10), .Point.new(30,30),color1,color2,Thisform.nmode)
                    Case i=3
                        br = .Drawing2D.LinearGradientBrush.new(.Point.new(1,1), .Point.new(10,10),color1,color2,Thisform.nmode)
                    Case i=4
                        br = .Drawing2D.LinearGradientBrush.new(.Point.new(10,10), .Point.new(80,80),color1,color2,Thisform.nmode)
                Endcase
                loGfx.FillRectangle(br,Rect)
                Pen = .Pen.new(.Color.gold, 6)
                loGfx.DrawRectangle(Pen,Rect)
                Pen.dispose()
                br.dispose()
                h=h+130
            Endfor
            *texte
            Local loFont As xfcFont
            Local loBrush As xfcLinearGradientBrush
            Local loRectangleF As xfcRectangleF
            Local loSizeF As xfcSizeF

            ystring="Yousfi Benameur November,2008"
            loFont = .Font.new([tahoma] , 10,  .FontStyle.BoldItalic)
            loSizeF = loGfx.MeasureString(ystring, loFont)
            loRectangleF =_Screen.System.Drawing.RectangleF.new(This.Width-loSizeF.Width-10,520+5,loSizeF.Width, loSizeF.Height)
            loBrush = .Drawing2D.LinearGradientBrush.new(loRectangleF,.Color.red,.Color.green,3)
            loGfx.DrawString(ystring, loFont,loBrush, loRectangleF)

        Endwith
        Return
    Endproc

    Procedure imgcanvas2.Click

        Try
            Local lcBell
            lcBell = Set("Bell")
            Set Bell To (Addbs(Getenv('windir')))+"MEDIA\notify.WAV"
            ?? Chr(7)
            Set Bell To (lcBell)
        Catch
        Endtry

        Thisform.yrandom()
        Thisform.imgcanvas1.Draw()
        This.Draw()
    Endproc

    Procedure imgcanvas2.MouseLeave
        Lparameters nButton, nShift, nXCoord, nYCoord
        Thisform.Over=.F.
        This.MousePointer=0
        This.Draw
    Endproc

    Procedure imgcanvas2.MouseEnter
        Lparameters nButton, nShift, nXCoord, nYCoord
        Thisform.Over=.T.
        This.MousePointer=15
        This.Draw
    Endproc

    Procedure imgcanvas2.beforedraw
        Thisform.LockScreen = .T.
        Local path4 As xfcGraphicsPath
        Local loFont As xfcFont
        Local strformat As xfcStringFormat
        Local loGfx As xfcGraphics
        loGfx = This.ogfx
        Local butcolor
        Local rc, rc2,rc3,path1,path2,path3,br1,br2,br3
        Thisform.yrandom()
        If  Type("thisform.ycolor1")="N"
            acol1=Thisform.ycolor1
        Else
            acol1=Evaluate(Thisform.ycolor1)
        Endi

        If  Type("thisform.ycolor2")="N"
            acol2=Thisform.ycolor2
        Else
            acol2=Evaluate(Thisform.ycolor2)
        Endi


        With _Screen.System.Drawing
            If Thisform.Over
                butcolor  = .Color.gold
                butfcolor = .Color.black

            Else
                butcolor  = .Color.fromRGB(acol1)
                butfcolor = .Color.fromRGB(acol2)
            Endif
            loGfx.Clear(.Color.fromRGB(This.Parent.BackColor))
            loGfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias

            * draw coloured button
            a=Thisform.btnoffset
            w=2.1*This.Height -8-a
            h=This.Height-8-a

            rc = .Rectangle.new(a,a,w, h)
            path1 = .Drawing2D.GraphicsPath.new()
            path1.addRectangle(rc)
            br1 = .Drawing2D.LinearGradientBrush.new(.Rectangle.new(0,0,This.Width,This.Height),butcolor,.Color.White,90,.T.)

            delta=7
            path_ = .Drawing2D.GraphicsPath.new()
            rc_ = .Rectangle.new(a+delta,a+delta,w-2*delta, h-2*delta)
            path_.addRectangle(rc_)
            Pen = .Pen.new(.Color.red,1)

            * draw shadow
            rc2 =.Rectangle.new(2*a,2*a,w,h)
            rc2.offset(1.4*Thisform.shadowoffset,1.4* Thisform.shadowoffset)
            path2 = .Drawing2D.GraphicsPath.new()
            path2.addRectangle(rc2)
            br2 = .Drawing2D.PathGradientBrush.new(path2)
            br2.CenterColor = .Color.black
            br2.SurroundColors = .Color.fromRGB(This.Parent.BackColor)

            * draw all paths
            loGfx.FillPath(br2, path2)
            loGfx.FillPath(br1, path1)
            loGfx.drawPath(Pen, path1)
            loGfx.drawPath(Pen,path_)

            br1.dispose()
            br2.dispose()

            If Thisform.Over=.T.
                *effect mouseEnter
                brush =.Drawing2D.PathGradientBrush.new(path_)
                brush.CenterColor = .Color.yellow
                Dimension surround(3)
                surround(1)=.Color.red
                surround(2)=.Color.green
                surround(3)=.Color.blue
                For i=1 To 3
                    brush.SurroundColors(i) = surround(i)
                Endfor
                Rect =.Rectangle.new(a, a, w, h)
                loGfx.FillPath(brush, path1)
            Else
                brush =.Drawing2D.PathGradientBrush.new(path_)
                brush.CenterColor = .Color.White
                Dimension surround(3)
                surround(1)=.Color.green
                surround(2)=.Color.yellow
                surround(3)=.Color.blue
                For i=1 To 3
                    brush.SurroundColors(i) = surround(i)
                Endfor
                Rect =.Rectangle.new(a, a, w, h)
                loGfx.FillPath(brush, path1)
            Endi

            * draw the text
            Local loBrush As xfcBrush
            Thisform.yrandom()
            If Thisform.Over=.T.
                loBrush = .SolidBrush.new(.Color.red)
            Else
                loBrush = .SolidBrush.new(.Color.fromRGB(Thisform.ycolor2))
            Endi
            Local loRect As xfcRectangle
            loRect =.Rectangle.new(a,a,w, h)
            * Get a basic string format object, then set properties
            Local loStringFormat As xfcStringFormat
            loStringFormat = .StringFormat.new()
            loStringFormat.Alignment = .StringAlignment.Center
            loStringFormat.LineAlignment =.StringAlignment.Center

            * Create a Font object
            Local loFont As xfcFont
            loFont = .Font.new(Thisform.buttonfont,Thisform.buttonfontsize, .FontStyle.Bold, .GraphicsUnit.Point)
            * draw text
            loGfx.DrawString(Thisform.ocaption ,loFont, loBrush, loRect, loStringFormat)
            loBrush.dispose()

            Thisform.LockScreen = .F.
        Endwith
    Endproc


Enddefine
*End code

 

usings gradients in gdiplusX
usings gradients in gdiplusX
usings gradients in gdiplusX

usings gradients in gdiplusX

*ChapIII-points,circles

*draw random points on area
*draw circles

*Begin code
Do Locfile("system.app","app")
Set Classlib To Locfile("gdiplusX","vcx")
Publi yform
yform=Newobject("asup")
yform.Show
Release Classlib gdiplusX
Read Events
Return

Define Class asup As Form
    Top = 17
    Left = 112
    Height = 505
    Width = 579
    Caption = "Some gdiplusX adapted samples"
    ycase = 0
    Name = "Form1"

    Add Object imgcanvas1 As imgcanvas With ;
        Anchor = 15, ;
        Height = 460, ;
        Left = 0, ;
        Top = 0, ;
        Width = 579, ;
        Name = "Imgcanvas1"

    Add Object command1 As CommandButton With ;
        Top = 468, ;
        Left = 115, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Points", ;
        Name = "Command1"

    Add Object command2 As CommandButton With ;
        Top = 468, ;
        Left = 210, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Circles0", ;
        Name = "Command2"

    Add Object command3 As CommandButton With ;
        Top = 469, ;
        Left = 408, ;
        Height = 27, ;
        Width = 84, ;
        Caption = "Circles", ;
        Name = "Command3"

    Procedure Init
        Thisform.ycase=0
    Endproc


    Procedure imgcanvas1.beforedraw

        With _Screen.System.drawing

            If Thisform.ycase=1 Or Thisform.ycase=2
                This.Clear(.Color.black)
            Endi
            logfx=This.ogfx
            logfx.SmoothingMode = .Drawing2D.SmoothingMode.AntiAlias
            logfx.resetTransform()
            Do Case
                Case Thisform.ycase=0
                    Pen=.Pen.new(.Color.LightGreen,5)
                    pen1=.Pen.new(.Color.red,5)
                    This.Clear(.Color.black)
                    For i = 1 To 200 Step 5
                        If Mod(i,2)=0
                            logfx.DrawEllipse(Pen,This.Width/2 - i, This.Height/2 - i, i * 2, i * 2)
                        Else
                            logfx.DrawEllipse(pen1,This.Width/2 - i, This.Height/2 - i, i * 2, i * 2)
                        Endi
                    Endfor
                    Pen.dispose()
                    pen1.dispose

                Case Thisform.ycase=1

                    For i = 1 To 2000
                        gnLower = 1
                        gnUpper = 16777000
                        xc= Int((gnUpper - gnLower + 1) * Rand( ) + gnLower)

                        gnLower = 1
                        gnUpper = This.Width
                        x= Int((gnUpper - gnLower + 1) * Rand( ) + gnLower)

                        gnLower = 1
                        gnUpper = This.Height
                        Y= Int((gnUpper - gnLower + 1) * Rand( ) + gnLower)

                        br = .SolidBrush.new(.Color.fromRGB(xc))
                        This.ogfx.FillEllipse(br, x, Y, 10, 10)

                    Endfor

                Case Thisform.ycase=2
                    This.Clear(.Color.black)
                    logfx.translatetransform(0.7*This.Width/2,0.7*This.Height/2)
                    For j=1 To 3
                        i=This.Width/8-3*j
                        Do Case
                            Case j=1
                                Pen=.Pen.new(.Color.LightGreen,2)
                            Case j=2
                                i=This.Width/8
                                Pen=.Pen.new(.Color.red,2)
                            Case j=3
                                Pen=.Pen.new(.Color.white,2)
                        Endcase


                        For alpha=0 To 360 Step 10
                            logfx.DrawEllipse(Pen, (This.Width/2.5-i)*Cos(alpha), (This.Height/2.5-i )*Sin(alpha), i * 2 ,i*2 )
                        Endfor

                    Endfor

                    Pen.dispose()
            Endcase

        Endwith
    Endproc

    Procedure command1.Click
        Thisform.ycase=1
        Thisform.imgcanvas1.Draw()
    Endproc

    Procedure command2.Click
        Thisform.ycase=0
        Thisform.imgcanvas1.Draw()
    Endproc

    Procedure command3.Click
        Thisform.ycase=2
        Thisform.imgcanvas1.Draw()
    Endproc

    Procedure Destroy
        Clea Events
    Endproc
Enddefine

*End code

 

GdiplusX drawings part II
GdiplusX drawings part II
GdiplusX drawings part II

*Chap IV-this code watermarks text on image at a specified position

*Begin Code
Local m.yrep
m.yrep=Addbs(Justpath(Sys(16,1)))

Local lcSource, lnWidth, lnHeight
lcSource = Getpict()
If Empty(lcSource)
    Return
Endif
Do Locfile("System.App")

Set Defa To (yrep)
Do While.T.
    yi=Inputbox("1 Top/left--2 en Top/right----3 bottom/left----4 bottom/right","Position the watermark on image 1-4","1")
    yi=Val(yi)
    If yi=1 Or yi=2 Or yi=3 Or yi=4
        Exit
    Else
        Loop
    Endi
Enddo

With _Screen.System.Drawing
    Local loBmp As xfcBitmap
    loBmp = .Bitmap.FromFile(lcSource)
    logfx= .Graphics.FromImage(loBmp)
    lnWidth = loBmp.Width
    lnHeight = loBmp.Height
    logfx.drawimage(loBmp,0,0,lnWidth,lnHeight)


    *text1
    ystring="© Copyright YB 2010"
    loFont = .Font.New([tahoma],16,  .FontStyle.BoldItalic)
    loSizeF = logfx.MeasureString(ystring, loFont)

    Local x,Y
    Do Case
        Case yi=1
            *adjust coordonnées x,y (first text) and (x1,y1) second text
            *En haut ,à gauche
            x=20
            Y=20

        Case yi=2
            *top,left
            x=lnWidth-loSizeF.Width-10
            Y=20

        Case yi=3
            *bottom,left
            x=10
            Y=lnHeight-loSizeF.Height-10

        Case yi=4
            *bottom,right
            x=lnWidth-loSizeF.Width-10
            Y=lnHeight-loSizeF.Height-10
    Endcase

    loRectangleF =_Screen.System.Drawing.RectangleF.New(x,Y,loSizeF.Width, loSizeF.Height)
    *loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.fromargb(128,128,128,127),.Color.fromaRGb(128,128,128,127),3)
    loBrush = .SolidBrush.New(.Color.fromargb(180,128,128,127))   &&alpha=180
    logfx.DrawString(ystring, loFont,loBrush, loRectangleF)

    loBmp.Save([myImage.png] ,  .Imaging.ImageFormat.Png)
    Run /N "mspaint" myImage.Png

Endwith
Retu

*End Code

 

can adjust in the code the watermark position-can also make multi watermarks on any image.
can adjust in the code the watermark position-can also make multi watermarks on any image.
can adjust in the code the watermark position-can also make multi watermarks on any image.

can adjust in the code the watermark position-can also make multi watermarks on any image.

*this code make batch watermarks on all images in a folder.
*it creates a new folder "images" and builfd the watermarked here.
*adjust alpha in code for best watermark viewing .

*Begin code
Local lcSource, lnWidth, lnHeight

yrep=Getdir("c:\","","",16384)
Set Defa To (yrep)
gnbre=Adir(gabase,"*.jpg")    &&idem pour *.png,*.gif,*.tif...
If gnbre=0
    Messagebox("Pas d'image dans "+m.yrep,16+4096,"Erroe")
    Return
Endi

Do Locfile("System.App")


If Directory(m.yrep+"images")
    Dele File (m.yrep+"images\*.*")
Else
    Md  (m.yrep+"images")
Endi


Do While.T.
    yi=Inputbox("1 top/left--2  top/right----3 bottom/left----4 bottom/right"," watermark Position on image 1-4","1")
    yi=Val(yi)
    If yi=1 Or yi=2 Or yi=3 Or yi=4
        Exit
    Else
        Loop
    Endi
Enddo
Wait Window("W a i t  p l e a s e . . . . . . . !") At Srows()/2,Scols()/2 Nowait
Set Defa To (yrep)
With _Screen.System.Drawing
    For i=1 To gnbre
        lcSource=gabase(i,1)

        Local loBmp As xfcBitmap
        loBmp = .Bitmap.FromFile(lcSource)
        logfx= .Graphics.FromImage(loBmp)
        lnWidth = loBmp.Width
        lnHeight = loBmp.Height
        logfx.drawimage(loBmp,0,0,lnWidth,lnHeight)

        *text1
        ystring="©Copyright YB 2010"
        loFont = .Font.New([Tahoma] , 16 ,  .FontStyle.BoldItalic)
        loSizeF = logfx.MeasureString(ystring, loFont)

        Local x,Y

        Do Case
            Case yi=1
                *adjust coordonnées x,y (first text) and (x1,y1) second text
                *En haut ,à gauche
                x=20
                Y=20

            Case yi=2
                *En haut ,à droite
                x=lnWidth-loSizeF.Width-10
                If x<0
                    x=10
                Endi
                Y=20

            Case yi=3
                *En bas à gauche
                x=10
                Y=lnHeight-loSizeF.Height-10

            Case yi=4
                *En bas à droite
                x=lnWidth-loSizeF.Width-10
                Y=lnHeight-loSizeF.Height-10
                If x<0
                    x=10
                Endi
        Endcase

        loRectangleF =_Screen.System.Drawing.RectangleF.New(x,Y,loSizeF.Width, loSizeF.Height)
        *loBrush = .Drawing2D.LinearGradientBrush.New(loRectangleF,.Color.fromargb(128,128,128,127),.Color.fromaRGb(128,128,128,127),3)
        loBrush = .SolidBrush.New(.Color.fromargb(180,128,128,127))   &&alpha=180  adjust 0-255
        logfx.DrawString(ystring, loFont,loBrush, loRectangleF)

        loBmp.Save[m.yrep+[images\]+gabase[i,1],  ;
.Imaging.ImageFormat.png]
    Endfor
Endwith
Wait Clear
Local m.oo
m.oo=m.yrep+"images"
Run/N explorer &oo

Retu

*End code

 

Remark:If you select all code for copy press CTRL+C instead of the right click menu( it deforms some codes parts ) !!

To be informed of the latest articles, subscribe:
Comment on this post