As the form will only render part of my full graphic, it may be that I only need to cache that specific part of it. I would then start to consider panning and the implications that has. This means, each time I reach a granularity reload point, I need to recreate my in-memory images (ie, not too often). Presumably zooming involves rendering maps at a greater granularity, therefore this suggests reloading another background map image each time I zoom/at certain stages within the zoom cycle. Knowing I need to support panning, zooming etc, I know I need to employ transformations to my co-ordinates. If you have hundreds of items to draw, it may be worth investing in storing the regions in an easily searchable structure and filtering out those you don't need with a simple algorithm, painting only those that remain. if the ClipRectangle doesn't Intersect with the region of the polygon the area you anticipate drawing, don't draw it. It sounds like you might be unnecessarily painting everything each time OnPaint is called. I have kept the comments at an engineering level because you must be a competant programmer to be involved in such a project, but I would quickly branch off an mention that the PaintEventsArgs.ClipRectangle is the area than needs to be painted. If you must go the GDI+ route, off the top of my head, what follows is probably the route I would investigate first (noting that I do not have the full scope to consider). If you are familiar with GDI, it may be worth going unmanaged as it is considerably quicker, or perhaps make the leap to WPF to benefit from accelerated graphics rendering (although that brings other issues with it). GDI+ may simply not be the appropriate technology to use. that sounds like a great project to be involved in. Can you help me, or put me in the right way. I don't know how to improve performance or what technic to use. But some maps has thousand of polygons and drawing all of them every time the paint event fires even to redraw a small region is very slow. I'm developing an application that draws a map using polygons (ESRI shape maps) like those you can see in google map (states, rivers, streets, etc), and the application has zoom, pan, etc. PictureBox1.Top, pictureBox1.Right, pictureBox1.Bottom) G.DrawString( "This is a diagonal line drawn on the control", _ ' Create a local version of the graphics object for the PictureBox. Private Sub pictureBox1_Paint( ByVal sender As Object, ByVal e As ) ' Add the PictureBox control to the Form. ' Connect the Paint event of the PictureBox to the event handler method.ĪddHandler pictureBox1.Paint, AddressOf Me.pictureBox1_Paint ' Dock the PictureBox to the form and set its background to white. Private Sub Form1_Load( ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Here I have an example that creates a PictureBox control on the form and uses the Paint event to draw it: According to your post, I don’t know exactly what would you like to draw on your form of the project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |