在可缩放和可滚动的pictureBox中的特定位置绘制一个圆 [英] draw a circle in specific position in a zoomable and scrollable pictureBox
本文介绍了在可缩放和可滚动的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
是您的敌人.它根本没有帮助,只会消耗您的开发时间,性能和资源.它的用途主要是静态图像,也许是可重新加载/可替换的-就是这样.
这是您应该使用的替代方法(请参阅我的解决方案): ^ ].
不要告诉我,如果使用这种方式,您将无法在文件中保存图像.您可以使用PictureBox
,甚至更好.如果您仍然有疑问,请提出问题.我会回答.
但是Forms通常对于这类事情来说是一个糟糕的UI库.如果切换到WPF,则几乎不需要编写任何有关缩放,平移甚至渲染的程序-一切都已完成.您只需将对象添加到Canvas
.您可以将所有内容放入ViewBox
,它将自动缩放.有很多好处.
—SA
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 withPictureBox
. 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 toCanvas
. You can put all inViewBox
which will zoom automatically. A lot of benefits.
—SA
这篇关于在可缩放和可滚动的pictureBox中的特定位置绘制一个圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文