Form1:
BackgroundImage:挑一個不規則型狀的圖片
BackgroundImageLayoutStretch
FormBorderStyle :none

重點在下面二個屬性:
設為圖片的背景色,且都相同
BackColor:圖片的背景顏色
TransparencyKey:圖片的背景顏色
  當指派 ColorTransparencyKey 屬性時,具有相同 BackColor 的表單區域將透明地顯示。


表單在超過色彩32bit就會有問題,解決方法:

 private void Form1_Load(object sender, EventArgs e)
 {
     ((Bitmap)this.BackgroundImage).MakeTransparent();
 }



不規則表單,沒有邊框,表單不會移動,不能關閉

表單關閉作法:

 private void Form1_DoubleClick(object sender, EventArgs e)
 {
      this.Close();
 }


移動表單作法:

bool start = false;
int x, y;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
     start = true;
     this.x = e.X;
     this.y = e.Y;
}

private void Form1_MouseMove(object sender, MouseEventArgs e)
{
     if (start)
     {
         this.Location = new Point(this.Location.X + e.X - x, this.Location.Y + e.Y - y);
      }
}

private void Form1_MouseUp(object sender, MouseEventArgs e)
{
     start = false;
}




arrow
arrow
    全站熱搜
    創作者介紹
    創作者 janema66 的頭像
    janema66

    貞愛講

    janema66 發表在 痞客邦 留言(1) 人氣()