wxWidgets自定义窗口形状(PNG)

发布于 2024-09-27 07:00:51 字数 312 浏览 0 评论 0 原文

我正在为 wxWidgets 使用 wxPython 绑定。是否可以从 PNG 图像和计数 alpha 通道创建自定义形状的窗口?看一下 VS2010 启动画面就明白我的意思了:

alt text

突出显示区域(圆角和阴影)不锐利,他们使用 alpha 通道来看起来平滑。

更新:我不仅想要自定义形状,还想要平滑自定义形状

更新2:似乎没有办法用wx :(

I'm using wxPython bindings for wxWidgets. Is it possible to create custom-shaped window from PNG image and in count alpha-channel? Take a look at VS2010 splash screen to see what I mean:

alt text

Highlighted zones (rounded corner and shadow) are not sharp, they use alpha-channel to look smooth.

Update: I want not only custom shape, but smooth custom shape

Update 2: Seems like there is no way to do this with wx :(

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

世界如花海般美丽 2024-10-04 07:00:51

Have a look at the shapedwindow from the docs and demos of wxpython

乖乖公主 2024-10-04 07:00:51

如果您想要启动屏幕,可以使用 AdvancedSplash 支持屏蔽的类。

If you want a Splash screen you can use the AdvancedSplash class which supports masking.

杯别 2024-10-04 07:00:51

据我所知,至少有一种方法可以实现这一点:

  1. 构造一个启动窗口,但不显示它(只是构造和初始化)。该窗口应该是无边框的,并且应该为未来的阴影渐变留出一些边距。
  2. 将底层窗口的部分渐变为图像。
  3. 显示启动窗口。使用您需要的所有透明内容绘制存储的图像、绘制阴影和启动画面。

然而这种方法只适用于闪屏:(

As far as I know there is at least one way of accomplishing this:

  1. Construct a splash window, but do not show it (just construct and init). This window should be borderless and should have some margins for future shadow' gradients.
  2. Grad the portion of an underlaying window to an image.
  3. Show the splash window. Paint the stored image, draw the shadows and the splash picture with all the transparent stuff you need.

However this method is only suitable for splash screens :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文