Click here to Skip to main content
15,902,893 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have a map in a zoomable and scrollable pictureBox(Its a control) and I want to search a city then it becomes highlight for me.

My question is how can I draw a circle in specific position in a zoomable and scrollable pictureBox?

Please help me.

Thanks in Advance.
Posted
Updated 6-Jun-11 19:48pm
v4

1 solution

To make is zoomable and scrollable, PictureBox is your enemy. It won't help at all, only will eat up your development time, performance and resources. It's purpose is mostly static image, maybe reloadable/replaceable — that's it.

This is what you should use instead (see my solution): How do I clear a panel from old drawing[^].

Don't tell me that you won't be able to save the image in file if you use this way. You can, and even better then with PictureBox. If you still in doubt, ask a question; I'll answer.

[EDIT]
But Forms is generally a bad UI library for such things. If you switch to WPF, you virtually won't need to program anything about zooming, panning, even rendering — everything is already done. You simply add objects to Canvas. You can put all in ViewBox which will zoom automatically. A lot of benefits.

—SA
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 7-Jun-11 2:11am    
OP commented:

Thank u for your answer.
You mean in this case I shouldnt use this kind of control.dont u?
then how can I zoom in a picture and also draw in it?
could u explain more!
Sergey Alexandrovich Kryukov 7-Jun-11 2:14am    
Rendering with Graphics means vector approach. Read my referenced answer -- you will see that you render using Graphic instance and some data. In this data, have a Zoom parameter. Scale all you coordinate points by this parameter. To zoom you simply change this parameter and call Invalidate on the control where you render graphics.
Wait a minute... one more idea...
--SA
Sergey Alexandrovich Kryukov 7-Jun-11 2:18am    
See also my update (after [EDIT]).
--SA

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