在Windows窗体画布等效 [英] Equivalent of canvas in Windows forms

查看:152
本文介绍了在Windows窗体画布等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个简单的应用程序来显示多个图像以下任一其他。
在WPF中,我用帆布数相当于在图像的数量,并添加这些画布主画布。
和使用图片在每个画布上的控制,我上传的图片与我和它看起来不错。

I am creating a simple app to display multiple images one below the other. In WPF, I used Number of canvas equivalent to number of images and added those canvas to the main canvas. And using Image control in each canvas, i uploaded the images with me and it is looking good.

现在,我试图做的Windows窗体相同。
我试图面板(如WPF主画布),并通过使用Panel_Paint事件画在它的图像。没事。但我需要添加的东西(如我在WPF中添加了多个帆布),但没有得到任何罢工的事情。
我计划在几板,但它们都需要Panel_Paint到绘制图像it.That一些什么难以维持......任何其他的想法?

Now, I Am trying to do the same in Windows forms. I tried Panel (as the main canvas in WPF) and draw images over it by using Panel_Paint event. it is fine. But I need to add something(as I added multiple canvas in WPF), but did not get strike any thing. I planned for few panels, but all them need Panel_Paint to draw images over it.That is some what difficult to maintain... any other ideas?

推荐答案

您可以创建自己的自定义控制和覆盖OnPaint方法。在那里,你将能够画出任何你喜欢帆布像模式。创建元素指定它的坐标,用Graphics对象绘制它。而对于叠加使用线性绘制顺序,后来绘制的项目将是最顶端。

You can create your own custom control and override OnPaint method. There you will be able to draw whatever you like in Canvas like mode. Create element specify its coordinates, draw it with Graphics object. And for overlaying use linear drawing order, items drawn later will be top most.

这篇关于在Windows窗体画布等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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