Winform窗體後果實例剖析。本站提示廣大學習愛好者:(Winform窗體後果實例剖析)文章只能為提供參考,不一定能成為您想要的結果。以下是Winform窗體後果實例剖析正文
本文實例剖析了Winform窗體後果。分享給年夜家供年夜家參考。詳細以下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication4 { public partial class Form3 : Form { bool flag = false; public Form3() { InitializeComponent(); flag = true; } #region user32.dll //導入user32.dll [System.Runtime.InteropServices.DllImport("user32")] //聲明API函數 private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags); #endregion #region 常量 //正面_程度偏向 const int AW_HOR_POSITIVE = 0x0001; //負面_程度偏向 const int AW_HOR_NEGATIVE = 0x0002; //正面_垂直偏向 const int AW_VER_POSITIVE = 0x0004; //負面_垂直偏向 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 (flag) rtn = AW_HOR_POSITIVE; else rtn = AW_VER_POSITIVE; } else if (pos.Equals(1)) { //斷定是橫向照樣縱向 if (flag) rtn = AW_HOR_NEGATIVE; else rtn = AW_VER_NEGATIVE; } return rtn; } #endregion private void button1_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)); //動畫——窗體淡出殊效 AnimateWindow(this.Handle, 1000, AW_BLEND | AW_HIDE | IsHorOrVer(1)); //動畫——窗體淡入殊效 AnimateWindow(this.Handle, 1000, AW_BLEND | AW_ACTIVATE | IsHorOrVer(0)); //動畫——窗體由周圍向中間減少直至消逝 AnimateWindow(this.Handle, 1000, AW_CENTER | AW_HIDE | IsHorOrVer(1)); //動畫——窗體由中間向周圍擴大 AnimateWindow(this.Handle, 1000, AW_CENTER | AW_ACTIVATE | IsHorOrVer(0)); } } }
願望本文所述對年夜家的C#法式設計有所贊助。