ScreenShot
option explicit

if (Output.Width mod 2) = 1 then
 Output.Move 0, 0, (Output.ScaleX(Output.Width + 1, 3,1)), (Output.ScaleY(Output.Height, 3, 1))
end if    
output.backcolor=vbgreen
output.drawtext "Click on the arrow to transfer image from NS Basic picture box on left to S309PictureBox on right"
output.drawtext ""
output.drawtext "Click on box on right to clear it."

addobject "PictureBox","nsBox",10,100,101,101
nsbox.backcolor = vbwhite
nsbox.borderstyle = 1
nsbox.scalemode = 3
nsbox.fillcolor = vbblue

addobject "S309.PictureBox.1", "btnGrab",120,130,0,0
btnGrab.autosize = true
btngrab.borderstyle = 1
btngrab.appearance = 1
btngrab.clip = true
btngrab.cliptop = 0
btngrab.clipleft = 16
btngrab.clipwidth = 16
btngrab.clipheight = 16
btngrab.resourcefile = "pwd_res.dll"
btngrab.resourcebitmapid = 133
 
addobject "S309.PictureBox.1","picBox",150,100,100,100
picbox.width = 100 ' ns basic creation error
picbox.height = 100 ' ns basic creation error
picbox.backcolor = vbRed
picbox.borderstyle = 1

nsbox.drawcircle 50,50,49

sub btnGrab_Click()
  dim nTopOffset, nLeftOffset
  nTopOffset = picBox.ScreenTop - picBox.Top
  nLeftOffset = picBox.ScreenLeft - picBox.Left
  picBox.clip = true
  picBox.ClipHeight = nsbox.height - 2 ' subtract border height
  picBox.ClipWidth = nsBox.width - 2 ' subtract border width
  picBox.ClipTop = nTopOffset + nsBox.top + 1 ' add 1 for border 
  picBox.ClipLeft = nLeftOffset + nsBox.left + 1 ' add 1 for border
  picBox.CaptureScreen
end sub  

sub picBox_Click()
  picbox.cls
end sub