Click here to Skip to main content
15,886,572 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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

C#
e.Graphics.FillEllipse(Brushes.CornflowerBlue, 100, 100, 100, 100);
           e.Graphics.DrawEllipse(Pens.Green, 100, 100, 100, 100);
 
Share this answer
 
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);
 
Share this answer
 
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
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900