#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Testing GDI+ Class" FROM 5,5 TO 600, 800 PIXEL
// ownd:setcolor(nrgb(120,120,120),nrgb(120,120,120))
@28,4 button "rectangle" size 120,30 Action Drawrectangle(ownd)
@28,24 button "roundrect" size 120,30 Action Drawroundrect(ownd)
@28,44 button "drawImage" size 120,30 Action DrawImage(ownd)
@28,64 button "drawEllipse" size 120,30 Action DrawEllipse(ownd)
@28,84 button "drawlight" size 120,30 Action Drawlight(ownd)
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function Drawrectangle(ownd)
local hdc:= oWnd:getdc()
local oGraphics := Graphics():New( ownd:hDC )
local oPen := Pen():New( 255, 0, 0, 255 , 10 , .T.)
oGraphics:DrawRect( oPen, , 300, 300, 70, 60 )
oGraphics:destroy()
oWnd:releasedc()
Return nil
function Drawroundrect(ownd)
local hdc:= oWnd:getdc()
local oGraphics := Graphics():New( ownd:hDC )
local oPen2 := Pen():New( 255, 255, 0, 0 , 3 )
local oPath:= Path():new()
oPath:AddRoundRect( 30, 30 , 50, 50 , 9 )
oGraphics:DrawPath( oPen2, oPath )
oGraphics:destroy()
oWnd:releasedc()
Return nil
function DrawImage(ownd)
local hdc:= oWnd:getdc()
local oGraphics := Graphics():New( ownd:hDC )
local oImage:= GDIBmp():new("C:\fwh\bitmaps\pngs\image2.png" )
oGraphics:DrawImage( oImage , 60 ,60 )
oGraphics:destroy()
oWnd:releasedc()
Return nil
function DrawEllipse(ownd)
local hdc:= oWnd:getdc()
local oGraphics := Graphics():New( ownd:hDC )
local oBrush2 := Brush():NewSolidBrush( 150, 0, 255, 167 )
local oPen2 := Pen():New( 255, 255, 0, 0 , 3 )
oGraphics:DrawEllipse( oPen2, oBrush2 , 500, 100, 60, 60 )
oGraphics:destroy()
oWnd:releasedc()
Return nil
function Drawlight(ownd)
local hdc:= oWnd:getdc()
local oGraphics := Graphics():New( ownd:hDC )
local oPen
local n
oPen := Pen():New( 255 , 0, 0 , 0 , .T.)
oGraphics:DrawRoundRect( oPen, , 400 , 200, 100 , 150 )
oPen:setColor( 255 , 214, 234, 249 )
oPen:setsize(1)
for n = 1 to 10
oPen:setcolor( 255-n*25 , 214, 234, 249 )
oGraphics:DrawRoundRect( oPen, , 400-n , 200-n, 100+n*2 , 150+ n*2 )
next
open:destroy()
oGraphics:destroy()
oWnd:releasedc()
Return nil