在扩展的玻璃框架上添加透明图像

发布于 11-28 02:07 字数 550 浏览 5 评论 0原文

我在使用 Windows 窗体中的 DWM 扩展​​玻璃框架时遇到了一些小问题。

我扩展了 winform 的玻璃框架,并添加了一个自定义控件,该控件在其上绘制一个带有白色背景的选项卡,非常类似于 google chrome 选项卡。然后我在选项卡区域添加了一些文本,到目前为止,一切正常。

现在,我有另一个控件(PictureBox),它有一个透明的 png 作为图像,并且我想允许将此控件拖放到选项卡上的某个位置。结果是我的 PictureBox 的一半可以在选项卡上(带有文本的白色背景),另一半可以在玻璃框架上。

如果我的 PictureBox 有透明的 BackColor,只要我停留在玻璃框架上,一切都可以,但是当我进入选项卡时,DWM 会认为它是透明的,并绘制玻璃而不是选项卡背景,正如我所说, png 不应该专门出现在标签或玻璃上,它可以放在两者上。

有办法处理这个问题吗? 感谢您的帮助,非常感谢;-))

Ps:我已经考虑过制作 PictureBox 区域的 CopyFromScreen 并将其设置为背景图像,但它并没有像玻璃上的部分那么有帮助如果我移动 WinForm,则不会刷新。

I am experiencing a little problem with DWM extended glassframe in a windows form.

I have extended the glass frame of my winform and added a custom control that draws a tab onto it with a white background, pretty much like google chrome tabs. Then I have added some text in the tab region and up to here, everything work fine.

Now, I have another control (PictureBox) that has a transparent png as image, and, I'd like to allow this control to be dragged and dropped somewhere onto the tab. The result is that half of my PictureBox can be on the tab (white background with text) and the other half on the glass frame.

If my PictureBox has a transparent BackColor, everything is ok as long as I stay on the glass frame but when I get onto the tab, the DWM considers it as transparent and draws the glass instead of the tab background, and as I said, the png is not supposed to be specifically on the tab, or on the glass, it could be dropped across both of them.

Is there a way to handle this ?
Thanks for your help, much much much appreciated ;-))

Ps: I've already considered making a CopyFromScreen of the PictureBox region and set it as BackgroundImage, but it doesn't help that much as the part that would be on the glass wouldn't refresh if I move my WinForm.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文