Winform窗體效果實(shí)例分析
更新時(shí)間:2015年09月02日 16:21:43 作者:我心依舊
這篇文章主要介紹了Winform窗體效果,涉及WinForm窗體設(shè)計(jì)的常見參數(shù)設(shè)置及使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
本文實(shí)例分析了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
//導(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;
//隱藏對(duì)象
const int AW_HIDE = 0x10000;
//顯示對(duì)象
const int AW_ACTIVATE = 0x20000;
//拉幕滑動(dòng)效果
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)
{
//動(dòng)畫——窗體向上拖拉
AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | IsHorOrVer(1));
//動(dòng)畫——窗體向下拖拉
AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_ACTIVATE | IsHorOrVer(0));
//動(dòng)畫——窗體淡出特效
AnimateWindow(this.Handle, 1000, AW_BLEND | AW_HIDE | IsHorOrVer(1));
//動(dòng)畫——窗體淡入特效
AnimateWindow(this.Handle, 1000, AW_BLEND | AW_ACTIVATE | IsHorOrVer(0));
//動(dòng)畫——窗體由四周向中心縮小直至消失
AnimateWindow(this.Handle, 1000, AW_CENTER | AW_HIDE | IsHorOrVer(1));
//動(dòng)畫——窗體由中心向四周擴(kuò)展
AnimateWindow(this.Handle, 1000, AW_CENTER | AW_ACTIVATE | IsHorOrVer(0));
}
}
}
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
您可能感興趣的文章:
- WinForm實(shí)現(xiàn)窗體最大化并遮蓋任務(wù)欄的方法
- C#實(shí)現(xiàn)WinForm禁止最大化、最小化、雙擊標(biāo)題欄、雙擊圖標(biāo)等操作的方法
- Winform實(shí)現(xiàn)鼠標(biāo)可穿透的窗體鏤空效果
- WinForm實(shí)現(xiàn)自定義右下角提示效果的方法
- WinForm實(shí)現(xiàn)仿視頻播放器左下角滾動(dòng)新聞效果的方法
- C#實(shí)現(xiàn)winform漸變效果的方法
- WinForm實(shí)現(xiàn)同時(shí)讓兩個(gè)窗體有激活效果的特效實(shí)例
- C# WinForm實(shí)現(xiàn)Win7 Aero透明效果代碼
- winform下實(shí)現(xiàn)win7 Aero磨砂效果實(shí)現(xiàn)代碼
- 用 C# Winform做出全透明的磨砂玻璃窗體效果代碼
- WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法示例
相關(guān)文章
C#中Hashtable和Dictionary的區(qū)別與用法示例
由于 Hashtable 和 Dictionary 同時(shí)存在, 在使用場(chǎng)景上必然存在選擇性, 并不任何時(shí)刻都能相互替代。所以這篇文章主要給大家介紹了關(guān)于C#中Hashtable和Dictionary區(qū)別的相關(guān)資料,需要的朋友可以參考下2021-05-05
淺析.NET中AsyncLocal的實(shí)現(xiàn)原理
這篇文章主要為大家詳細(xì)介紹了.NET中AsyncLocal的具體實(shí)現(xiàn)原理,文中的示例代碼講解詳細(xì),具有一定的借鑒價(jià)值,如果有講得不清晰或不準(zhǔn)確的地方,還望指出2023-08-08
Unity3D UI Text得分?jǐn)?shù)字增加的實(shí)例代碼
這篇文章主要介紹了Unity3D UI Text得分?jǐn)?shù)字增加方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2021-04-04
C#使用ICSharpCode.SharpZipLib.dll進(jìn)行文件的壓縮與解壓功能
這篇文章主要介紹了C#使用ICSharpCode.SharpZipLib.dll進(jìn)行文件的壓縮與解壓功能,需要的朋友可以參考下2017-12-12

