在图C#透明窗体 [英] C# Transparent Form in Panel
本文介绍了在图C#透明窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试创建一个显示在面板半透明形式。我可以显示的形式在面板,但不透明性不会工作的形式是不透明的。
im trying to create a semi-transparent form which is displayed in a panel. i can display the form in the panel but the opacity property wont work and the form is non-transparent.
private void button1_Click(object sender, EventArgs e)
{
Form fr = new Form();
fr.FormBorderStyle = FormBorderStyle.None;
fr.BackColor = Color.Black;
fr.TopLevel = false;
fr.Opacity = 0.5;
this.panel1.Controls.Add(fr);
fr.Show();
}
任何想法如何,我可以处理这个问题? 感谢您的answeres!
any ideas how i can handle that? Thanks for your answeres!
推荐答案
的WinForms仅支持顶级形式部分透明。如果你想创建一个部分透明的UI元素的应用程序,您可能需要使用WPF,或处理所有的绘制自己。我很抱歉的坏消息。
Winforms only supports partial transparency for top-level forms. If you want to create an application with partially-transparent UI elements, you either need to use WPF, or handle all the drawing yourself. Sorry to be the bearer of bad news.
这篇关于在图C#透明窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文