1.首先,窗体的FormBorderStyle设置成None,不要控制边框。
2.然后,TransparencyKey和BackColor颜色设置成相同的,这样,窗体就透明了。
3.最后,窗体的拖动
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Left += e.Location.X - this.oldX;
//新的鼠标位置
this.Top += e.Location.Y - this.oldY;
}
}private int oldX = ;
private int oldY = ;
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.oldX = e.Location.X;
//鼠标原来位置
this.oldY = e.Location.Y;
}
}