代码如下
public partial class frmLognIn : Form
{
Bitmap bit;
public frmLognIn()
{
InitializeComponent();
bit = new Bitmap(pictureBox1.Image);
bit.MakeTransparent(Color.Blue);
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawImage((Image)bit, new Point(0, 0));
}
}
注意点: frm的TransparencyKey属性需要设置为Control
.