Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.5
hi,
 
i have one xml file which contains the longitude and latitude for the ground.
 
This xml file was generated from Sony gps enabled camera.
 
As per the xml i have to draw the circle or rectangle in the my 2d screen..
 
kindly provide few idea to draw things in the 2d form
 
Thanks
Vijay r
Posted 24-Apr-11 20:59pm
vijayr889
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to draw in any System.Windows.Forms.Control (including System.Windows.Forms.Form) in the overridden method OnPaint or in the handler of the event Paint. For rendering, use the instance of the class System.Drawing.Graphics taken from the event arguments parameter.
 
When you need to change the rendered image, just change the data used for rendering and call Control.Invalidate. It will trigger sending Windows message WM_PAINT and firing the event. To improve performance you can use Control.Invalidate methods with parameter (Rectangle or Region) to trigger re-rendering only some part of the scene.
 
Warning: do not repeat the common mistake — do not use System.Windows.Forms.PictireBox. You can draw on it, but this is absolutely pointless; just an extra level of indirection with loss of performance and no added benefits (except hassles such as those you face in change of size).
 
—SA
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

inside the paint event of your form just enter the following code...
 
e.Graphics.FillEllipse(Brushes.CornflowerBlue, 100, 100, 100, 100);
           e.Graphics.DrawEllipse(Pens.Green, 100, 100, 100, 100);
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

e.Graphics.FillEllipse(Brushes.CornflowerBlue, 100, 100, 100, 100);
           e.Graphics.DrawEllipse(Pens.Green, 100, 100, 100, 100);
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100