在可缩放和可滚动的pictureBox中的特定位置绘制一个圆 [英] draw a circle in specific position in a zoomable and scrollable pictureBox

查看:95
本文介绍了在可缩放和可滚动的pictureBox中的特定位置绘制一个圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我在一个可缩放和可滚动的pictureBox(它是一个控件)中有一张地图,我想搜索一个城市,然后它对我来说就成为亮点.

我的问题是如何在可缩放和可滚动的PictureBox中的特定位置绘制一个圆?

请帮帮我.

在此先感谢.

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.

推荐答案

要使内容可缩放和滚动,PictureBox是您的敌人.它根本没有帮助,只会消耗您的开发时间,性能和资源.它的用途主要是静态图像,也许是可重新加载/可替换的-就是这样.

这是您应该使用的替代方法(请参阅我的解决方案):
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.


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


这篇关于在可缩放和可滚动的pictureBox中的特定位置绘制一个圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆