【发布时间】:2008-10-06 23:47:17
【问题描述】:
最简单的方法是什么?是否可以使用托管代码?
【问题讨论】:
最简单的方法是什么?是否可以使用托管代码?
【问题讨论】:
this.BackgroundImage = //Image
this.FormBorderStyle = FormBorderStyle.None;
this.Width = this.BackgroundImage.Width;
this.Height = this.BackgroundImage.Height;
this.TransparencyKey = Color.FromArgb(0, 255, 0); //Contrast Color
这允许您基于图像创建表单,并使用透明度索引使表单看起来不是矩形。
【讨论】:
@Geoff 在 winforms 中显示了正确的方式。
但是如果您打算使用 WPF 而不是 Winforms,那么 WPF(.NET3.0+) 提供了非常灵活的方法来创建任意形状的自定义窗口。也可以看看这篇文章http://www.codeproject.com/KB/WPF/wpfpopup.aspx
【讨论】: