尝试使用Graphics.DrawImage制作透明图像...... [英] Trying to use Graphics.DrawImage to make transparent image...

查看:98
本文介绍了尝试使用Graphics.DrawImage制作透明图像......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

展开 | 选择 | Wrap | 行号

推荐答案

好吧,我想我知道这里的问题是什么......

绘制图像时,您将其绘制到源图像。如果您在源图像上绘制源图像的透明副本,则不会看到任何更改。


您需要做的是创建一个新的,空白的图像,然后绘制到那个。他们实际上在你链接的例子中有这个,但是很难发现(也抓住了我!)所以你错过它并不奇怪。


(来自那个page ...)
All right, I think I know what the problem is here...

When you draw your image, you''re drawing it to the source image. If you draw a transparent copy of your source image on your source image, you''re not going to see any change.

What you need to do is to create a new, blank image, then draw to that. They actually have this in the example you linked, but it''s tough to spot (caught me too!) so it''s not surprising you missed it.

(From that page...)
展开 | 选择 | Wrap | 行号


编辑:

好​​的我得到的东西要显示。 ..现在问题是,透明度是不是工作大声笑。

继承我的更新功能...

Ok I get the thing to display... Now the problem is, is the transparency isn''t working lol.
Heres my updated function...
展开 | 选择 | Wrap | 行号


在此示例中,bmp是源图像。在您的代码中,这将是FadeBmp。您需要将目标(用于创建图形对象的目标)传递给PictureBox。

阅读Graphics.DrawImage方法的doc,看看第一个参数实际意味着什么,这应该有助于为你澄清事情:)
In this example, bmp is the source image. In your code, this would be FadeBmp. You need to pass the destination (the one you used to create the graphics object) to the PictureBox.

Read the doc for the Graphics.DrawImage method to see what that first parameter actually means, that should help clarify things for you :)


这篇关于尝试使用Graphics.DrawImage制作透明图像......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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