private double opacity = 0;

//API
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
//說明:http://www.vbgood.com/api-releasecapture.html
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
//說明:http://www.vbgood.com/api-sendmessage.html
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;

public frmMain()
{
    InitializeComponent();
}

private void frmMain_Load(object sender, EventArgs e)
{
    Opacity = 0;//完全透明
}

private void frmMain_MouseDown(object sender, MouseEventArgs e)
{
    ReleaseCapture();
    SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}

private void timer1_Tick(object sender, EventArgs e)
{
    if (opacity <= 1) {
        opacity += 0.05;
        Opacity = opacity;
    }
}

arrow
arrow
    全站熱搜

    souts 發表在 痞客邦 留言(0) 人氣()