|
Rad, this can be handled quite nicely by placing a PictureBox on your form then drawing to it using the graphics functions. Heres an example using a BMP of map. Just make sure to note the dimensions of the BMP using pbrush.exe or the like and size your PictureBox/Form accordingly:
Break On
$Form = CreateObject("Kixtart.Form") $Form.Size = 640, 480
; Create PictureBox that is same size as BMP ...
$PictureBox = $Form.PictureBox $PictureBox.Size = 295, 381 $PictureBox.Picture = ".\map.bmp" $PictureBox.Center
; Set the drawing (pen) width to five pixels ...
$PictureBox.DrawWidth = 5
; Create a draw button ...
$Button = $Form.ToolButton $Button.Center $Button.Top = $PictureBox.Top $Button.Left = $PictureBox.Right + 10 $Button.Text = "Draw" $Button.OnClick = "OnButtonClick()"
$Form.Center $Form.Show
While $Form.Visible $=Execute($Form.DoEvents) Loop Exit 1
Function OnButtonClick
; Set some randow coords for our line ...
$FromX = RND($PictureBox.ClientWidth) $FromY = RND($PictureBox.ClientHeight) $ToX = RND($PictureBox.ClientWidth) $ToY = RND($PictureBox.ClientHeight)
; Draw the line ...
$PictureBox.Line($FromX, $FromY, $ToX, $ToY, "Red" )
EndFunction
Hope this helps ...
|