windows 启动画面的透明度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1675630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:23:09  来源:igfitidea点击:

Transparency in splash screen

windowsvb.netwinformstransparentsplash-screen

提问by OrElse

I saw the splash screen of the Corel-Draw 12 application and lost my mind!

我看到 Corel-Draw 12 应用程序的启动画面,我失去了理智!

What technique do they use? On application start-up they load a transparent image, use windows api or what?

他们使用什么技术?在应用程序启动时,他们加载透明图像,使用 windows api 还是什么?

How do they achieve this transparency?

他们如何实现这种透明度?

回答by jheddings

Here is a demo projectfor both VB.NET & C#.

这是VB.NET 和 C#的演示项目

回答by Quintin Robinson

If you are using winforms with vb.net you can modify the opacity of any form by setting the Form.Opacityproperty. I am not familiar with the splash screen you are speaking about but it shouldn't be too difficult to achieve a similar effect.

如果您在 vb.net 中使用 winforms,您可以通过设置Form.Opacity属性来修改任何表单的不透明度。我不熟悉你所说的启动画面,但要达到类似的效果应该不会太难。

回答by Justin R.

If you're using WPF, set the AllowsTransparancy, WindowStyleand Backgroundattributes on the Window object:

如果您使用 WPF,请在 Window 对象上设置AllowsTransparancy,WindowStyleBackground属性:

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  AllowsTransparency="True"
  WindowStyle="None"
  Background="Transparent">
  <!-- more -->
</Window>

回答by Jrud

I am also unfamiliar with this flash screen... but if it slowly fades or something, then I would go with Quintin's answer here. Opacity at a certain percentage will show another form through yours.

我也不熟悉这个闪光屏幕......但如果它慢慢消失或其他什么,那么我会在这里接受 Quintin 的回答。一定百分比的不透明度将通过您的形式显示另一种形式。

If the splash screen is just an image and some of it is see-through and some of it isn't, then you can set the transparency key on your form to a certain color, then set the form's background color equal to that, and then whatever image you wish to display should be loaded into a picture box. Make sure you use a .GIF image though! or some other format that supports deleting out the background. JPG's and BMP's are worthless here since their "empty" color becomes white instead of transparent.

如果初始屏幕只是一个图像,其中一些是透明的,而另一些不是,那么您可以将表单上的透明度键设置为某种颜色,然后将表单的背景颜色设置为等于该颜色,并且那么你想显示的任何图像都应该加载到图片框中。但请确保使用 .GIF 图像!或其他一些支持删除背景的格式。JPG 和 BMP 在这里毫无价值,因为它们的“空”颜色变为白色而不是透明。