Drawing a map
I am trying to draw a map in a picturebox. First I load the base image which is a 1024x1024 bitmap of the map (no annotations) from Private Sub draw_map(), then to add all the map synbols, the data is collected from a simple text file, analysed and then drawn over the base map using x y coordinates. This is called from Private Sub draw_objects()
So when the form containing the picturebox loads it runs
The strange thing is that all the objects are drawn first, then the map, over the objects (or the objects disappear again, I don't know). I tried doing it from the form_Paint but that only results in the symbols reloading endlessly and flashing on the screen.
I'm thinkig of going back to VB6
I am so new to this so be gentle
Please post a sample of your code from the draw_objects function. Are you sure you're drawing the objects on the picturebox and not on the form?
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Thanks for replying Phil, I will try to provide som code here (the pictureBox is names picChart) :
Originally Posted by Phil Weber
So far so good, this displays as it should. Then to load the map symbols it uses
Private Sub draw_map()
Dim vsImage As Image
vsImage = System.Drawing.Image.FromFile(vsPath & "simple.bmp")
picChart.Image = vsImage
This is only a part of the code where it draws the buoy.gif onto the map.
Private Sub draw_objects()
Dim drawSymbol As System.Drawing.Graphics
drawSymbol = picChart.CreateGraphics
objImage = System.Drawing.Image.FromFile("C:\bla bla bla\images\buoy.gif")
drawSymbol.DrawImage(objImage, xCoord - 5, yCoord - 5, 10, 10)
(The xCoord and yCoord are calculated from Latitude/Longitude values in the objects.txt file)
Then the final part is
My understanding is that using the _Paint will replace the AutoRedraw previosly used in VB6.
Private Sub picChart_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles picChart.Paint
I've also tried running the draw_map and draw_object on the form Load but that will only show the objects loading once and then clear them. At least this way keeps them flashing on the screen so I can see them
Please let me know if you need any more code, I'm not really sure what I should be showing here.
Last Post: 01-28-2006, 08:25 AM
Last Post: 01-26-2006, 02:25 AM
By drkybelk in forum VB Classic
Last Post: 09-15-2005, 12:06 PM
By Woody Medina in forum Architecture and Design
Last Post: 08-01-2001, 08:40 AM
By mark hembree in forum ASP.NET
Last Post: 01-11-2001, 11:21 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center