Example showing 3D sphere drawn using GINO

module 
use System%Windows%Forms
use GinoGraphics
use System
implicit none
type,extends(System%Windows%Forms%Form), namespace(spheres) :: Form1
    class(System%Windows%Forms%PictureBox),private ,pointer :: pictureBox1
    class(System%Windows%Forms%Button),private ,pointer :: button1
    class(System%Windows%Forms%Panel),private ,pointer :: panel1
    class(System%Windows%Forms%Label),private ,pointer :: label1
    class(System%Windows%Forms%RadioButton),private ,pointer :: radioButton1
    class(System%Windows%Forms%RadioButton),private ,pointer :: radioButton2
    class(System%Windows%Forms%RadioButton),private ,pointer :: radioButton3
    type(System%ComponentModel%Container),pointer, private :: components
    contains
    initial,pass,public  :: Form1_ctor
    procedure,pass,private  :: Dispose
    procedure,pass,private  :: InitializeComponent
    procedure,pass,private  :: pictureBox1_Paint
    procedure,pass,private  :: button1_Click
    procedure,pass,private  :: radioButton1_CheckedChanged
    procedure,pass,private  :: radioButton2_CheckedChanged
    procedure,pass,private  :: comboBox1_SelectedIndexChanged
    procedure,pass,private  :: Form1_Load
    procedure,pass,private  :: numericUpDown1_ValueChanged
    procedure,pass,private  :: numericUpDown2_ValueChanged
    procedure,pass,private  :: radioButton3_CheckedChanged
end type Form1
contains
subroutine Form1_ctor(this)
    class(Form1) :: this  
   call this%InitializeComponent()
   !
   ! Add any other Initialization statements here
   !
end subroutine
! 
! Clean up any resources being used
!
subroutine Dispose(this,disposing)
   class(Form1) :: this
    logical(1)     :: disposing
      if( disposing .eqv. .true._1 ) then 
        if( associated( this%components ) ) then
            call this%components%Dispose()
        end if
        call this%System%Windows%Forms%Form%Dispose( disposing )
   end if
end subroutine
! <--InitializeComponent--> 
! Required method for Designer support - DO NOT modify
! the contents of this method with the code editor.
!
subroutine InitializeComponent(this)
    class(Form1) :: this
    type(System%Drawing%Point),pointer :: ASPTMP0
    type(System%Drawing%Size),pointer :: ASPTMP1
    type(System%Windows%Forms%PaintEventHandler),pointer :: ASPTMP2
    type(System%Drawing%Point),pointer :: ASPTMP3
    type(System%Drawing%Size),pointer :: ASPTMP4
    type(System%EventHandler),pointer :: ASPTMP5
    class(System%Windows%Forms%Control%ControlCollection),pointer :: ASPTMP6
    class(System%Windows%Forms%Control%ControlCollection),pointer :: ASPTMP7
    class(System%Windows%Forms%Control%ControlCollection),pointer :: ASPTMP8
    class(System%Windows%Forms%Control%ControlCollection),pointer :: ASPTMP9
    type(System%Drawing%Point),pointer :: ASPTMP10
    type(System%Drawing%Size),pointer :: ASPTMP11
    type(System%Drawing%Point),pointer :: ASPTMP12
    type(System%Drawing%Size),pointer :: ASPTMP13
    type(System%EventHandler),pointer :: ASPTMP14
    type(System%Drawing%Point),pointer :: ASPTMP15
    type(System%Drawing%Size),pointer :: ASPTMP16
    type(System%EventHandler),pointer :: ASPTMP17
    type(System%Drawing%Point),pointer :: ASPTMP18
    type(System%Drawing%Size),pointer :: ASPTMP19
    type(System%Drawing%Point),pointer :: ASPTMP20
    type(System%Drawing%Size),pointer :: ASPTMP21
    type(System%EventHandler),pointer :: ASPTMP22
    type(System%Drawing%Size),pointer :: ASPTMP23
    type(System%Drawing%Size),pointer :: ASPTMP24
    class(System%Windows%Forms%Control%ControlCollection),pointer :: ASPTMP25
    class(System%Windows%Forms%Control%ControlCollection),pointer :: ASPTMP26
    class(System%Windows%Forms%Control%ControlCollection),pointer :: ASPTMP27
    allocate(this%pictureBox1,source=System%Windows%Forms%PictureBox())
    allocate(this%button1,source=System%Windows%Forms%Button())
    allocate(this%panel1,source=System%Windows%Forms%Panel())
    allocate(this%radioButton2,source=System%Windows%Forms%RadioButton())
    allocate(this%radioButton1,source=System%Windows%Forms%RadioButton())
    allocate(this%label1,source=System%Windows%Forms%Label())
    allocate(this%radioButton3,source=System%Windows%Forms%RadioButton())
    call this%panel1%SuspendLayout()
    call this%SuspendLayout()
    !
    !pictureBox1
    !
    allocate(ASPTMP0,source=System%Drawing%Point(32, &
        40))
    this%pictureBox1%Location => ASPTMP0
    this%pictureBox1%Name => USTRING("pictureBox1")
    allocate(ASPTMP1,source=System%Drawing%Size(344, &
        304))
    this%pictureBox1%Size => ASPTMP1
    this%pictureBox1%TabIndex = 0
    this%pictureBox1%TabStop = .false._1
    allocate(ASPTMP2,source=System%Windows%Forms%PaintEventHandler(this%pictureBox1_Paint))
    call this%pictureBox1%add_Paint(ASPTMP2)
    !
    !button1
    !
    allocate(ASPTMP3,source=System%Drawing%Point(408, &
        40))
    this%button1%Location => ASPTMP3
    this%button1%Name => USTRING("button1")
    allocate(ASPTMP4,source=System%Drawing%Size(144, &
        24))
    this%button1%Size => ASPTMP4
    this%button1%TabIndex = 1
    this%button1%Text => USTRING("Rotate")
    allocate(ASPTMP5,source=System%EventHandler(this%button1_Click))
    call this%button1%add_Click(ASPTMP5)
    !
    !panel1
    !
    this%panel1%BackColor => System%Drawing%SystemColors%Control
    this%panel1%BorderStyle => System%Windows%Forms%BorderStyle%Fixed3D
    ASPTMP9 => this%panel1%Controls
    call ASPTMP9%Add(this%radioButton3)
    call ASPTMP9%Add(this%radioButton2)
    call ASPTMP9%Add(this%radioButton1)
    call ASPTMP9%Add(this%label1)
    allocate(ASPTMP10,source=System%Drawing%Point(400, &
        136))
    this%panel1%Location => ASPTMP10
    this%panel1%Name => USTRING("panel1")
    allocate(ASPTMP11,source=System%Drawing%Size(176, &
        240))
    this%panel1%Size => ASPTMP11
    this%panel1%TabIndex = 3
    !
    !radioButton2
    !
    allocate(ASPTMP12,source=System%Drawing%Point(24, &
        72))
    this%radioButton2%Location => ASPTMP12
    this%radioButton2%Name => USTRING("radioButton2")
    allocate(ASPTMP13,source=System%Drawing%Size(136, &
        24))
    this%radioButton2%Size => ASPTMP13
    this%radioButton2%TabIndex = 5
    this%radioButton2%Text => USTRING("Red")
    allocate(ASPTMP14,source=System%EventHandler(this%radioButton2_CheckedChanged))
    call this%radioButton2%add_CheckedChanged(ASPTMP14)
    !
    !radioButton1
    !
    this%radioButton1%Checked = .true._1
    allocate(ASPTMP15,source=System%Drawing%Point(24, &
        40))
    this%radioButton1%Location => ASPTMP15
    this%radioButton1%Name => USTRING("radioButton1")
    allocate(ASPTMP16,source=System%Drawing%Size(128, &
        24))
    this%radioButton1%Size => ASPTMP16
    this%radioButton1%TabIndex = 4
    this%radioButton1%TabStop = .true._1
    this%radioButton1%Text => USTRING("Black")
    allocate(ASPTMP17,source=System%EventHandler(this%radioButton1_CheckedChanged))
    call this%radioButton1%add_CheckedChanged(ASPTMP17)
    !
    !label1
    !
    allocate(ASPTMP18,source=System%Drawing%Point(16, &
        16))
    this%label1%Location => ASPTMP18
    this%label1%Name => USTRING("label1")
    allocate(ASPTMP19,source=System%Drawing%Size(104, &
        16))
    this%label1%Size => ASPTMP19
    this%label1%TabIndex = 3
    this%label1%Text => USTRING("Object Colour")
    !
    !radioButton3
    !
    allocate(ASPTMP20,source=System%Drawing%Point(24, &
        104))
    this%radioButton3%Location => ASPTMP20
    this%radioButton3%Name => USTRING("radioButton3")
    allocate(ASPTMP21,source=System%Drawing%Size(136, &
        24))
    this%radioButton3%Size => ASPTMP21
    this%radioButton3%TabIndex = 6
    this%radioButton3%Text => USTRING("Orange")
    allocate(ASPTMP22,source=System%EventHandler(this%radioButton3_CheckedChanged))
    call this%radioButton3%add_CheckedChanged(ASPTMP22)
    !
    !Form1
    !
    allocate(ASPTMP23,source=System%Drawing%Size(5, &
        13))
    this%AutoScaleBaseSize => ASPTMP23
    allocate(ASPTMP24,source=System%Drawing%Size(592, &
        437))
    this%ClientSize => ASPTMP24
    ASPTMP27 => this%Controls
    call ASPTMP27%Add(this%panel1)
    call ASPTMP27%Add(this%button1)
    call ASPTMP27%Add(this%pictureBox1)
    this%Name => USTRING("Form1")
    this%Text => USTRING("Form1")
    call this%panel1%ResumeLayout(.false._1)
    call this%ResumeLayout(.false._1)
end subroutine
subroutine pictureBox1_Paint(this, sender, e)
use global
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%Windows%Forms%PaintEventArgs),target  :: e
type(System%IntPtr) :: hdc
    type(System%Drawing%Graphics), pointer :: graphobj
    
   
    type(GLIMIT) :: viewlim
    type(GLIMIT3) :: piclim
    Integer :: NUL = 0
    Integer :: isw
    graphobj => e%Graphics
    hdc = graphobj%GetHdc()
    piclim%xmin=-200.0
    piclim%xmax=200.0
    piclim%ymin=-200.0
    piclim%ymax=200.0
    piclim%zmin=-200.0
    piclim%zmax=200.0
    viewlim%xmin=0.0
    viewlim%xmax=80.0
    viewlim%ymin=0.0
    viewlim%ymax=80.0
    
        call Gino%OpenGino()
        call Gino%Mwinao(NUL, hdc.ToInt32())
        call Gino%SetViewport3D(piclim,viewlim)
        call Gino%UpdateView()
        call Gino%Rotate3D(Axis%GXAXIS,45.0)
        call Gino%Rotate3D(Axis%GYAXIS,rotat)
        call Gino%SetFacetFillStyle(FacetFillStyle%GHOLLOW)
        if(this%radioButton1%Checked)call Gino%SetLineColour(1)
        if(this%radioButton2%Checked)call Gino%SetLineColour(2)
        if(this%radioButton3%Checked)call Gino%SetLineColour(3)
		call Gino%DrawBezierSphere(0.0,0.0,0.0,100.0,0.0,0.0,0.0,25,25)
        call Gino%FlushGraphics()
        call graphobj%ReleaseHdc(hdc)
end subroutine
subroutine button1_Click(this, sender, e)
use global
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
        rotat=rotat+22.5
        call this%pictureBox1%Refresh()
end subroutine
subroutine radioButton1_CheckedChanged(this, sender, e)
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
        call this%pictureBox1%Refresh()
end subroutine
subroutine radioButton2_CheckedChanged(this, sender, e)
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
        call this%pictureBox1%Refresh()
end subroutine
subroutine comboBox1_SelectedIndexChanged(this, sender, e)
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
        call this%pictureBox1%Refresh()
end subroutine
subroutine Form1_Load(this, sender, e)
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
!    this%comboBox1%SelectedItem=1
end subroutine
subroutine numericUpDown1_ValueChanged(this, sender, e)
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
        call this%pictureBox1%Refresh()
end subroutine
subroutine numericUpDown2_ValueChanged(this, sender, e)
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
        call this%pictureBox1%Refresh()
end subroutine
subroutine radioButton3_CheckedChanged(this, sender, e)
    class(Form1) :: this
    class(System%Object),target  :: sender
    class(System%EventArgs),target  :: e
        call this%pictureBox1%Refresh()
end subroutine
end module 
program main
    !.nca (main,add=System%STAThreadAttribute())
    type(spheres%Form1),pointer :: form
    allocate( form )
    call System%Windows%Forms%Application%Run(form)
end program