Radimus
(KiX Supporter)
2003-02-01 12:33 AM
drawing on a kixform

This is what I'd like to do:

I want to display a map/picture on a form, and then draw lines from on spot on the map, to another.

as a possibility, I'd also like to be able to wipe the map and draw another set of lines?

on a kixform, with image, line and circle, can this be done?

I'm looking to make a visual representation of my remote sites and the connectivity between.. ping, trace, routes, etc...


JochenAdministrator
(KiX Supporter)
2003-01-31 01:09 PM
Re: drawing on a kixform

Basically Yes Conrad,

hmmm ... what do you try to do ? An Autorouter, Street Map ? Navigation System (to visualize tragets in Iraq ? [Eek!] )

Ok, for the technical side :

Try to make the complete form a .PictureBox (no, create the form and then create a PictureBox of the same or smaller size)

Add all Graphics you need then to $PictureBox.Line() etc ...

J.


JochenAdministrator
(KiX Supporter)
2003-01-31 01:10 PM
Re: drawing on a kixform

Oh ... its a Sitemap [Big Grin]

hmmm ... we could do this online If you like


ShawnAdministrator
(KiX Supporter)
2003-01-31 02:08 PM
Re: drawing on a kixform

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 = 640480

; Create PictureBox that is same size as BMP ...

$PictureBox = $Form.PictureBox
$PictureBox.Size = 295381
$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 ...


ShawnAdministrator
(KiX Supporter)
2003-01-31 02:19 PM
Re: drawing on a kixform

To clear the map, try this:



Function OnClearClick

 $PictureBox.Picture = ".\map.bmp"
 $PictureBox.Refresh

EndFunction



Kdyer
(KiX Supporter)
2003-01-31 02:23 PM
Re: drawing on a kixform

Rad,

Did you have a look at paint?

HTH,

Kent


JochenAdministrator
(KiX Supporter)
2003-01-31 02:39 PM
Re: drawing on a kixform

aka 'The KiXAsso Painter' [Big Grin]

Radimus
(KiX Supporter)
2003-01-31 03:49 PM
Re: drawing on a kixform

damn... easier that I thought...

The hard part is to make an array of the coordinated of the routers [Smile]

this kix ass [Big Grin]


Chris S.
(MM club member)
2003-01-31 05:44 PM
Re: drawing on a kixform

Here's another example of using the picturebox to draw lines and refresh the data: KiXforms: ProcessMon

Bryce
(KiX Supporter)
2003-01-31 07:56 PM
Re: drawing on a kixform

ohh this is very interesting!!

anyone have any pointers on how to find the short route of a given node structure?


Jack Lothian
(MM club member)
2003-01-31 08:09 PM
Re: drawing on a kixform

Use linear programming methods. [Big Grin]

Hi Bryce,

Long time no see. Good to see you here again. [Smile]

[ 31. January 2003, 20:10: Message edited by: Jack Lothian ]


Radimus
(KiX Supporter)
2003-01-31 08:20 PM
Re: drawing on a kixform

I have placed a listbox on top of a portion of a picturebox

when I refresh the picturebox, it overwrites the listbox, when I update/add to the listbox, the text space reappears but not the edges.

any way to keep it on top?


Bryce
(KiX Supporter)
2003-02-01 02:06 AM
Re: drawing on a kixform

this might be of some use....

http://www.wikipedia.org/wiki/Dijkstra%27s_algorithm