日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

winform窗體特效

 實(shí)力決定地位 2011-06-30
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
/// <summary>
/// API窗體動態(tài)特效
/// Create By 悠游人生
namespace WinformSP
{
    /// </summary>
    public partial class Form1 : Form
    {
        #region 構(gòu)造函數(shù)
        public Form1()
        {
            InitializeComponent();
            //默認(rèn)選擇橫向
            this.rdoHor.Checked = true;
        }
        #endregion
        #region user32.dll
        //導(dǎo)入user32.dll
        [System.Runtime.InteropServices.DllImport("user32")]
        //聲明API函數(shù)
        private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
        #endregion
        #region 常量
        //正面_水平方向
        const int AW_HOR_POSITIVE = 0x0001;
        //負(fù)面_水平方向
        const int AW_HOR_NEGATIVE = 0x0002;
        //正面_垂直方向
        const int AW_VER_POSITIVE = 0x0004;
        //負(fù)面_垂直方向
        const int AW_VER_NEGATIVE = 0x0008;
        //由中間四周展開或
        const int AW_CENTER = 0x0010;
        //隱藏對象
        const int AW_HIDE = 0x10000;
        //顯示對象
        const int AW_ACTIVATE = 0x20000;
        //拉幕滑動效果
        const int AW_SLIDE = 0x40000;
        //淡入淡出漸變效果
        const int AW_BLEND = 0x80000;
        #endregion
        #region 判斷方向
        public int IsHorOrVer(int pos)
        {
            int rtn = 0;
            //判斷是正方向還是反方向
            if (pos.Equals(0))
            {
                //判斷是橫向還是縱向
                if (rdoHor.Checked)
                    rtn = AW_HOR_POSITIVE;
                else rtn = AW_VER_POSITIVE;
            }
            else if (pos.Equals(1))
            {
                //判斷是橫向還是縱向
                if (rdoHor.Checked)
                    rtn = AW_HOR_NEGATIVE;
                else rtn = AW_VER_NEGATIVE;
            }
            return rtn;
        }
        #endregion
        #region 按鈕事件
        /// <summary>
        /// 窗體上下拉動
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSP1_Click(object sender, EventArgs e)
        {
            //動畫——窗體向上拖拉
            AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | IsHorOrVer(1));
            //動畫——窗體向下拖拉
            AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_ACTIVATE | IsHorOrVer(0));
        }
        /// <summary>
        /// 窗體淡入淡出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSP2_Click(object sender, EventArgs e)
        {
            //動畫——窗體淡出特效
            AnimateWindow(this.Handle, 1000, AW_BLEND | AW_HIDE | IsHorOrVer(1));
            //動畫——窗體淡入特效
            AnimateWindow(this.Handle, 1000, AW_BLEND | AW_ACTIVATE | IsHorOrVer(0));
        }
        /// <summary>
        /// 窗體展開縮小
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSP3_Click(object sender, EventArgs e)
        {
            //動畫——窗體由四周向中心縮小直至消失
            AnimateWindow(this.Handle, 1000, AW_CENTER | AW_HIDE | IsHorOrVer(1));
            //動畫——窗體由中心向四周擴(kuò)展
            AnimateWindow(this.Handle, 1000, AW_CENTER | AW_ACTIVATE | IsHorOrVer(0));
        }
        #endregion
    }
}
 
界面如下
 

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多