我用一个圆形图片做为WinForm窗体的背景,目的是想使运行时窗体是一个圆形的图片,设置了窗体的TransparencyKey属性,但是运行时窗体为矩形而且背景色是黑色的,代码如下:
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.Control;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(200, 200);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.TransparencyKey = this.BackColor 如果不设置TransparencyKey 属性,运行时窗体是圆形了,但是当拖动时又不是圆形了,有重影现象。
请问不需要通过设置this.Region,只是简单的通过设置一下窗体的属性,如何才能使窗体的形状和图片的形状一样,请指点。