将带有背景图像的图像保存到 C# 中的文件 [英] Saving image with backgroundimage to file in C#

查看:108
本文介绍了将带有背景图像的图像保存到 C# 中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表单上有一个图片框,BackgroundImage 属性设置为特定图像.图像的其余部分具有某些透明区域,因此背景图像显示在这些区域中.我想把它保存到文件中,但是图片框没有保存方法.image属性有save方法,但是它只保存图片的内容,不包括backgroundimage.关于如何保存两者的任何提示,以便它在文件中的外观与图片框上的外观完全相同?

I have a picturebox on the form, with BackgroundImage property set to certain image. The rest of the image has certain transparent areas, so that background image is shown in those areas. I want to save it to the file, but there is no save method for picturebox. There is a save method for image property, but then it only saves the content of the image, and does not include the backgroundimage. Any hints on how I can save both, so that it looks in the file exactly as it looks on the picturebox?

推荐答案

我设法通过简单地使用图形将两个图像组合在一起,然后将结果保存为单个图像对象来实现这一点.因此,我不再使用背景图片.

I have managed to accomplish this by simply combining two images together using graphics, and then saving the result as a single image object. Thus, I am not using background image anymore.

这篇关于将带有背景图像的图像保存到 C# 中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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