| Lahey .NET code | Lahey Win32 code |
subroutine pictureBox1_Paint(this, sender, e)
class(Form1) :: this
class(System%Object),target :: sender
class(System%Windows%Forms%PaintEventArgs),target :: e
type(System%IntPtr) :: hdc ! note1
type(System%Drawing%Graphics), pointer :: graphobj
Integer :: NUL = 0
!
! Declare variables
!
! Assign hatch & line style data for area fill
!
integer,dimension(5) :: fill = (/0,0,0,0,0/)
integer,dimension(5) :: line = (/2,7,8,3,5/)
character (len=10) :: str = '*.*.*.*.*.' ! note2
!
! Assign segment value data
!
real,dimension(5) :: value1 = (/44.9,21.6,18.7,12.8,2.0/)
real,dimension(5) :: value2 = (/24.9,27.7,21.5,22.7,3.2/)
!
!
character (len=80) :: keys = 'oil*. coal*. ! note3
!
!
!
! Declare Local variables
!
real :: rad,rad1,rad2,xcen,xlen,ycen,ylen,cw,ch
type (GDIM) paper
type (GLIMIT) :: pframe = GLIMIT(30.0,950.0,50.0,720.0)
type (GLIMIT) :: frame1 = GLIMIT(10.0,990.0,50.0,740.0)
type (GLIMIT) :: frame2 = GLIMIT(15.0,985.0,55.0,735.0)
graphobj => e%Graphics ! note1
hdc = graphobj%GetHdc()
!
! Enter GINO & initialise device
!
call Gino%OpenGino
call Gino%Mwinao(NUL,hdc.ToInt32()) ! note4
call Gino%DefinePictureUnits(0.2)
call Gino%SetWorkspaceLimit(1,2001)
call Gino%NewDrawing
call Graf%RestoreAxesSettings
cw = 7.5
ch = 7.5
call Gino%SetCharSize(cw,ch)
!
! Set up dimensions and mask
!
xlen=1000.0
ylen=750.0
xcen = xlen/2.5
ycen = ylen/2.0
rad1 = min(xlen/3.0,ylen/3.0)-10.0
rad2 = min(xlen/4.0,ylen/4.0)-10.0
call setmsk(rad2, xcen, ycen)
!
! Output 1st pie chart
!
call Graf%SetPieChartStartAngle(120.0)
call Graf%SetPieChartFrame(rad1, xcen, ycen)
call Graf%SetPieChartAnnotation(PieChartAnnotation%GEXTERNAL,0,1,0,0.0)
call Graf%PlotPieChart(5,value1,USTRING(str),2,fill,line)
call Gino%SetMaskMode(Switch%GOFF)
!
! Output 2nd pie chart
!
call Gino%SetLineColour(Colour%GBLACK)
call Graf%SetPieChartFrame(rad2, xcen, ycen)
call Graf%SetPieChartAnnotation(PieChartAnnotation%GINTERNAL,0,1,0,0.0)
call Graf%SetPieChartBoxType(ior(PieChartBoxType%GBOXED,PieChartBoxType
call Graf%PlotPieChart(5,value2,USTRING(str),2,fill,line)
!
! Draw key
!
call Gino%SetLineColour(Colour%GWHITE)
call Graf%SetTextChartAttribs(30.0,250.0,Justification%GLEFGNOHEAD,-1)
call Graf%DisplayFillColumn(800.0,500.0,5,fill,line,USTRING('*.'))
call Graf%DisplayStringColumn(840.0,500.0,5,USTRING(keys),16,USTRING('*
!
! Write title
!
call Graf%SetPlotFrame(pframe)
call Gino%SetCharSize(2.0*cw,2.0*ch)
call Graf%DrawGraphTitle &
(USTRING('*f101Production and Consumption of Primary Energy'),GCENTR
!
! Credit
!
call Gino%SetCharSize(0.75*cw,0.75*ch)
call Gino%MoveTo2D(600.0,65.0)
call Gino%DisplayStr(USTRING('Source : EEC'))
call Gino%FlushGraphics
!
! Close down device & leave GINO
!
call gSuspendDevice
call gCloseGino
call graphobj%ReleaseHdc(hdc)
end subroutine
|
Program GRAFEX4
use gino_f90
use graf_f90
!
!
!
!
!
! Declare variables
!
! Assign hatch & line style data for area fill
!
integer,dimension(5) :: fill = (/0,0,0,0,0/)
integer,dimension(5) :: line = (/2,7,8,3,5/)
character (len=2),dimension(5) :: str = (/'*.','*.','*.','*.','*.'/)
!
! Assign segment value data
!
real,dimension(5) :: value1 = (/44.9,21.6,18.7,12.8,2.0/)
real,dimension(5) :: value2 = (/24.9,27.7,21.5,22.7,3.2/)
!
!
character (len=16), dimension(5) :: keys = &
(/'oil*. ','coal*. ','natural gas*. ', &
'nuclear energy*.','electricity*. '/)
!
! Declare Local variables
!
real :: rad,rad1,rad2,xcen,xlen,ycen,ylen,cw,ch
type (GDIM) paper
type (GLIMIT) :: pframe = GLIMIT(30.0,950.0,50.0,720.0)
type (GLIMIT) :: frame1 = GLIMIT(10.0,990.0,50.0,740.0)
type (GLIMIT) :: frame2 = GLIMIT(15.0,985.0,55.0,735.0)
!
!
!
! Enter GINO & initialise device
!
call gOpenGino
call gMwin
call gDefinePictureUnits(0.2)
call gSetWorkspaceLimit(1,2001)
call gNewDrawing
call ggRestoreAxesSettings
cw = 7.5
ch = 7.5
call gSetCharSize(cw,ch)
!
! Set up dimensions and mask
!
xlen=1000.0
ylen=750.0
xcen = xlen/2.5
ycen = ylen/2.0
rad1 = min(xlen/3.0,ylen/3.0)-10.0
rad2 = min(xlen/4.0,ylen/4.0)-10.0
call setmsk(rad2, xcen, ycen)
!
! Output 1st pie chart
!
call ggSetPieChartStartAngle(120.0)
call ggSetPieChartFrame(rad1, xcen, ycen)
call ggSetPieChartAnnotation(GEXTERNAL,0,1,0,0.0)
call ggPlotPieChart(5,value1,str,fill,line)
call gSetMaskMode(GOFF)
!
! Output 2nd pie chart
!
call gSetLineColour(GBLACK)
call ggSetPieChartFrame(rad2, xcen, ycen)
call ggSetPieChartAnnotation(GINTERNAL,0,1,0,0.0)
call ggSetPieChartBoxType(ior(GBOXED,GFILLED),iff,10)
call ggPlotPieChart(5,value2,str,fill,line)
!
! Draw key
!
call gSetLineColour(icol)
call ggSetTextChartAttribs(30.0,250.0,GLEFT,GNOHEAD,-1)
call ggDisplayFillColumn(800.0,500.0,5,fill,line,'*.')
call ggDisplayStringColumn(840.0,500.0,5,keys,'*.')
!
! Write title
!
call ggSetPlotFrame(pframe)
call gSetCharSize(2.0*cw,2.0*ch)
call ggDrawGraphTitle &
('*f003Production and Consumption of Primary Energy',GCENTRE,GTOP)
!
! Credit
!
call gSetCharSize(0.75*cw,0.75*ch)
call gMoveTo2D(600.0,65.0)
call gDisplayStr('Source : EEC')
call gFlushGraphics
!
! Close down device & leave GINO
!
call gSuspendDevice
call gCloseGino
!
! Close Program
!
stop
end
|
| General Notes: 1. Remove the 'g' and 'gg' prefix from all routines and add Gino% or Graf% 2. Add USTRING function to each string passing routine 3. Add Class name to all Enumerators (pre-defined constants) Specific Notes: 1. Code needed for getting the PictureBox handle 2. Character arrays have to be turned into single strings 3. This is the call to direct GINO graphics to the PictureBox |