sub Rectangle(theSurface, x1, y1, x2, y2)
Dim theContour, theContourPart
Dim theParam
theSurface.Pen.Color = 1
Set theContour = Application.CreateObject(0, theParam)
Set theContourPart = theContour.Insert(0)
theContourPart.InsertVertex 0, x1, y1, 0
theContourPart.InsertVertex -1, x1, y2, 0
theContourPart.InsertVertex -1, x2, y2, 0
theContourPart.InsertVertex -1, x2, y1, 0
theContourPart.InsertVertex -1, x1, y1, 0
theSurface.PaintContour theContour, true
end sub
' Вызывается при отпускании клавиши мыши над окном карты
sub MapEditors_MouseUp(aButton, aShift, aX, aY)
Dim theImage, theParam
Dim theContour, theContourPart
Set theImage = Application.CreateObject(2, theParam)
theImage.Width = 800
theImage.Height = 600
theImage.ResolutionX = 400
theImage.ResolutionY = 400
Dim x1, y1, x2, y2
theImage.Surface.sPointDeviceToWorld 100, 100, x1, y1
theImage.Surface.sPointDeviceToWorld 200, 200, x2, y2
Rectangle theImage.Surface, x1, y1, x2, y2
theImage.SaveToFile "c:\tmp\image1.jpg"
end sub