ID2D1HwndRenderTarget总是有黑色的背景,而不是透明 [英] ID2D1HwndRenderTarget always having black background instead of transparent

查看:713
本文介绍了ID2D1HwndRenderTarget总是有黑色的背景,而不是透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个简单的透明窗口,在这里我可以借鉴的Direct2D

I am trying to create a simple transparent window where I can draw with Direct2D.

到目前为止,我做了什么:

So far what I have done:


  1. 创建的窗口

  2. 设置风格WS_EX_LAYERED

  3. 设置字母的颜色键#FFF

  4. 绘制使用Windows图形白色矩形

  5. 现在,窗口是透明的,每个像素的阿尔法

  6. 然后使目标窗外,并使用Direct2D的画

    • 请ALPHA _ preMULIPLIED目标

    • 清除与0.0阿尔法#FFF

我只是不知道如何使窗口透明。如果你能指出我的错误,我将不得不

I just don't know how to make window to transparent. If you can point out my mistake, I would be obliged

推荐答案

我不认为这是可能与DirectX。不过GDI做的工作。

I don't think it's possible with directX. However GDI does work.

在这里的源看看,看看它是如何做: http://pastebin.com/NJf8wi2V

Take a look at the source here to see how it's done: http://pastebin.com/NJf8wi2V

在源代码,你可以看到,有尝试使用DirectX / OpenGL的一个选项。但是你可以运行他们不工作见。

In the source you can see that there is an option to attempt to use directx/opengl. However as you can see from running they do not work.

这篇关于ID2D1HwndRenderTarget总是有黑色的背景,而不是透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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