窗体动态特效集锦

原创 2004年10月07日 16:20:00

hitwall.gif下面是头文件:
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
        TImage *Image1;
        TBitBtn *BitBtn1;
        TBitBtn *BitBtn2;
        TBitBtn *BitBtn3;
        TBitBtn *BitBtn4;
        TBitBtn *BitBtn5;
        TBitBtn *BitBtn6;
        TBitBtn *BitBtn7;
        TBitBtn *BitBtn8;
        TBitBtn *BitBtn9;
        TBitBtn *BitBtn10;
        TBitBtn *BitBtn11;
        TBitBtn *BitBtn12;
        TBitBtn *BitBtn13;
        TBitBtn *BitBtn14;
        TBitBtn *BitBtn15;
        TBitBtn *BitBtn16;
        TBitBtn *BitBtn17;
        TBitBtn *BitBtn18;
        TStaticText *StaticText1;
        TBitBtn *BitBtn19;
        TBitBtn *BitBtn20;
        TBitBtn *BitBtn21;
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall BitBtn1Click(TObject *Sender);
        void __fastcall BitBtn2Click(TObject *Sender);
        void __fastcall BitBtn3Click(TObject *Sender);
        void __fastcall BitBtn4Click(TObject *Sender);
        void __fastcall BitBtn5Click(TObject *Sender);
        void __fastcall BitBtn6Click(TObject *Sender);
        void __fastcall BitBtn7Click(TObject *Sender);
        void __fastcall BitBtn8Click(TObject *Sender);
        void __fastcall BitBtn9Click(TObject *Sender);
        void __fastcall BitBtn10Click(TObject *Sender);
        void __fastcall BitBtn11Click(TObject *Sender);
        void __fastcall BitBtn12Click(TObject *Sender);
        void __fastcall BitBtn13Click(TObject *Sender);
        void __fastcall BitBtn14Click(TObject *Sender);
        void __fastcall BitBtn15Click(TObject *Sender);
        void __fastcall BitBtn16Click(TObject *Sender);
        void __fastcall BitBtn17Click(TObject *Sender);
        void __fastcall BitBtn18Click(TObject *Sender);
        void __fastcall BitBtn19Click(TObject *Sender);
        void __fastcall BitBtn20Click(TObject *Sender);
        void __fastcall BitBtn21Click(TObject *Sender);
private:    // User declarations
        BITMAP bmp;
        HRGN MyRgn;
        Graphics::TBitmap *Bitmap1;
        int i,j;
        int WidthHalf;
        int HeightHalf;
        TRect Dest1,Source1,Dest2,Source2;
public:        // User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

 

///////////////////////////////////////////////////////////////////////
下面是CPP文件

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "math.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TForm1::FormCreate(TObject *Sender)
{
        Form1->BorderStyle = bsNone;
        Form1->Left = 0;
        Form1->Top = 0;
        Form1->Width = Screen->Width;
        Form1->Height = Screen->Height;//窗体全屏显示

        Bitmap1 = new Graphics::TBitmap();//定义一个图象句柄//
        Bitmap1->LoadFromFile("test.bmp");//设定所要特效显示的图象为factory.bmp//
        if(GetDeviceCaps(Form1->Canvas->Handle,BITSPIXEL)==8){//取得显示窗口的颜色属性
                GetObject(Bitmap1->Handle,sizeof(BITMAP),(LPSTR)&bmp);
                if (bmp.bmBitsPixel==8){//如果特效显示的图象颜色属性为256色//
                        SelectPalette(Form1->Canvas->Handle,Bitmap1->Palette,FALSE);//从特效显示的颜色画板中提取配色方案//
                        RealizePalette(Form1->Canvas->Handle); //在显示窗口中设置配色方案//
                }
                Bitmap1->HandleType=bmDDB;
        }
}

//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{//图象从中间向左右拉开!
        Form1->Refresh();
        WidthHalf=Bitmap1->Width/2+Bitmap1->Width%2;
        for(i=0;i<=WidthHalf; i++){
                Dest1=Rect(WidthHalf-i,0,WidthHalf+i,Bitmap1->Height);
                Source1=Rect(WidthHalf-i,0,WidthHalf+i,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);//图像的延迟显示//
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{//图象由左右拉向中间!
        Form1->Refresh();
        WidthHalf=Bitmap1->Width/2+Bitmap1->Width%2;
        Form1->Refresh();
        for(i=0;i<=WidthHalf;i++){
                Source1=Dest1=Rect(0,0,i,Bitmap1->Height);
                Source2=Dest2=Rect(Bitmap1->Width-i,0,Bitmap1->Width,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn3Click(TObject *Sender)
{//图象从中间分到两边
        Form1->Refresh();
        HeightHalf=Bitmap1->Height/2+Bitmap1->Height%2;
        for(i=0;i<=HeightHalf;i++){
                Dest1=Rect(0,HeightHalf-i,Bitmap1->Width,HeightHalf);
                Source1=Rect(0,0,Bitmap1->Width,i);
                Dest2=Rect(0,HeightHalf,Bitmap1->Width,HeightHalf+i);
                Source2=Rect(0,Bitmap1->Height-i,Bitmap1->Width,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn4Click(TObject *Sender)
{//图象从两边靠拢
        Form1->Refresh();
        HeightHalf=Bitmap1->Height/2+Bitmap1->Height%2;
        for(i=0;i<=HeightHalf;i++){
                Dest1=Rect(0,0,Bitmap1->Width,i);
                Source1=Rect(0,HeightHalf-i,Bitmap1->Width,HeightHalf);
                Dest2=Rect(0,Bitmap1->Height-i,
                Bitmap1->Width,Bitmap1->Height);
                Source2=Rect(0,HeightHalf,Bitmap1->Width,HeightHalf+i);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn5Click(TObject *Sender)
{//图象从左拉向右
        Form1->Refresh();
        for(i=Bitmap1->Width;i>=0;i--){
                Dest1=Rect(0,0,Bitmap1->Width-i,Bitmap1->Height);
                Source1=Rect(i,0,Bitmap1->Width,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn6Click(TObject *Sender)
{//图象从右拉到左
        Form1->Refresh();
        for(i=0;i<=Bitmap1->Width;i++){
                Dest1=Rect(Bitmap1->Width-i,0,Bitmap1->Width,Bitmap1->Height);
                Source1=Rect(0,0,i,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn7Click(TObject *Sender)
{//图象从上拉到下
        Form1->Refresh();
        for(i=0;i<=Bitmap1->Height;i++){
                Dest1=Rect(0,0,Bitmap1->Width,i);
                Source1=Rect(0,Bitmap1->Height-i,Bitmap1->Width,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<1;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn8Click(TObject *Sender)
{//图象从下拉到上
        Form1->Refresh();
        for(i=0;i<=Bitmap1->Height;i++){
                Dest1 =Rect(0,Bitmap1->Height-i,Bitmap1->Width,
                Bitmap1->Height);
                Source1 =Rect(0,0,Bitmap1->Width,i);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn9Click(TObject *Sender)
{//图象从左现到右
        Form1->Refresh();
        for(i=0;i<=Bitmap1->Width;i++){
                Dest1 =Rect(0,0,i,Bitmap1->Height);
                Source1 =Rect(0,0,i,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn10Click(TObject *Sender)
{//图象从右现到左
        Form1->Refresh();
        for(i=Bitmap1->Width;i>=0;i--){
                Dest1 =Rect(i+0,0,0+Bitmap1->Width,0+Bitmap1->Height);
                Source1 =Rect(i,0,Bitmap1->Width,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn11Click(TObject *Sender)
{//图象从上现到下
        Form1->Refresh();
        for(i=0;i<=Bitmap1->Height;i++){
                Dest1 =Rect(0,0,Bitmap1->Width+0,i+0);
                Source1 =Rect(0,0,Bitmap1->Width,i);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn12Click(TObject *Sender)
{//图象从下现到上
        Form1->Refresh();
        for(i=Bitmap1->Height;i>=0;i--){
                Dest1=Rect(0,i+0,Bitmap1->Width+0,Bitmap1->Height+0);
                Source1=Rect(0,i,Bitmap1->Width,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn13Click(TObject *Sender)
{//金属熔铸A
        Form1->Refresh();
        for(i=Bitmap1->Height;i>=0;i--){
                Source1 =Rect(0,i,Bitmap1->Width,i+1);
                for(int j1=0;j1<=i;j1++){
                        Dest1 =Rect(0 ,j1,Bitmap1->Width+0,j1+1);
                        Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                        for(j=0;j<10000;j++);
                }
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn14Click(TObject *Sender)
{//逆金属熔铸
        Form1->Refresh();
        for(i=0;i<=Bitmap1->Height;i++){
                Source1 =Rect(0,i,Bitmap1->Width,i+1);
                for(int j1=Bitmap1->Height-1;j1>=i;j1--){
                        Dest1 =Rect(0,j1,Bitmap1->Width,j1+1);
                        Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                        for(j=0;j<10000;j++);
                }
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn15Click(TObject *Sender)
{
        Form1->Refresh();
        int j1=sqrt(Bitmap1->Width*Bitmap1->Width+
        Bitmap1->Height*Bitmap1->Height)/2+4;
        for (i=1;i<j1;i++){
                MyRgn=CreateEllipticRgn(Bitmap1->Width/2-i,
                Bitmap1->Height/2-i,
                Bitmap1->Width/2+i,
                Bitmap1->Height/2+i);
                SelectObject(Canvas->Handle,MyRgn);
                Canvas->Draw(0,0,Bitmap1);
                DeleteObject(MyRgn);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn16Click(TObject *Sender)
{
        Form1->Refresh();
        HeightHalf=Bitmap1->Height/2+Bitmap1->Height%2;
        Source1=Rect(0,0,Bitmap1->Width,HeightHalf);
        Source2=Rect(0,HeightHalf,Bitmap1->Width,Bitmap1->Height);
        for(i=0;i<=Bitmap1->Width;i++){
                Dest1=Rect(0-Bitmap1->Width+i,0,i,0+HeightHalf);
                Dest2=Rect(Bitmap1->Width-i,HeightHalf,Bitmap1->Width+Bitmap1->Width-i,Bitmap1->Height+0);
                Form1->Canvas->MoveTo(0-Bitmap1->Width+i-1,0);
                Form1->Canvas->LineTo(0-Bitmap1->Width+i-1,HeightHalf);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                Form1->Canvas->MoveTo(Bitmap1->Width+Bitmap1->Width-i,0);
                Form1->Canvas->LineTo(Bitmap1->Width+Bitmap1->Width-i,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn17Click(TObject *Sender)
{
        Form1->Refresh();
        WidthHalf=Bitmap1->Width/2+Bitmap1->Width%2;
        Source1=Rect(0,0,WidthHalf,Bitmap1->Height);
        Source2=Rect(WidthHalf,0,Bitmap1->Width,Bitmap1->Height);
        for(i=0;i<=Bitmap1->Height;i++){
                Dest1=Rect(0,0-Bitmap1->Height+i,WidthHalf,0+i);//Bitmap1->Width
                Dest2=Rect(WidthHalf,Bitmap1->Height-i,Bitmap1->Width,0+i);//Bitmap1->Height+1);
                Canvas->MoveTo(0,0-Bitmap1->Height+i-1);
                Form1->Canvas->LineTo(WidthHalf,0-Bitmap1->Height+i-1);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                Form1->Canvas->MoveTo(WidthHalf,
                Bitmap1->Height+Bitmap1->Height-i);
                Form1->Canvas->LineTo(Bitmap1->Width,
                Bitmap1->Height+Bitmap1->Height-i);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn18Click(TObject *Sender)
{
        Form1->Refresh();
        WidthHalf=Bitmap1->Width/2+Bitmap1->Width%2;
        Source1=Rect(0,0,WidthHalf,Bitmap1->Height);
        Source2=Rect(WidthHalf,0,Bitmap1->Width,Bitmap1->Height);
        for(i=0;i<=Bitmap1->Height;i++){
                Dest1=Rect(0,0-Bitmap1->Height+i,WidthHalf,0+i);//Bitmap1->Width
                Dest2=Rect(WidthHalf,Bitmap1->Height-i,Bitmap1->Width,i-0);
                Canvas->MoveTo(0,0-Bitmap1->Height+i-1);
                Form1->Canvas->LineTo(WidthHalf,0-Bitmap1->Height+i-1);
                Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1);
                Form1->Canvas->MoveTo(WidthHalf,
                Bitmap1->Height+Bitmap1->Height-i);
                Form1->Canvas->LineTo(Bitmap1->Width,
                Bitmap1->Height+Bitmap1->Height-i);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn19Click(TObject *Sender)
{
        Form1->Refresh();
        Source2=Rect(0,0,Bitmap1->Width,Bitmap1->Height);
        for(i=0;i<=Bitmap1->Height;i++){
                Dest2=Rect(0,Bitmap1->Height-i,Bitmap1->Width,i-0);
                Canvas->MoveTo(0,0-Bitmap1->Height+i-1);
                Form1->Canvas->MoveTo(0,Bitmap1->Height+Bitmap1->Height-i);
                Form1->Canvas->LineTo(Bitmap1->Width,Bitmap1->Height+Bitmap1->Height-i);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn20Click(TObject *Render)
{
        Form1->Refresh();
        Source2=Rect(0,Bitmap1->Height,Bitmap1->Width,0);
        for(i=0;i<=Bitmap1->Width;i++){
                Dest2=Rect(i-0,Bitmap1->Height,Bitmap1->Width-i,0);
                Canvas->MoveTo(0-Bitmap1->Width+i-1,0);
                Form1->Canvas->MoveTo(Bitmap1->Width+Bitmap1->Width-i,0);
                Form1->Canvas->LineTo(Bitmap1->Width+Bitmap1->Width-i,Bitmap1->Height);
                Form1->Canvas->CopyRect(Dest2,Bitmap1->Canvas,Source2);
                for(j=0;j<10000;j++);
        }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn21Click(TObject *Sender)
{
        Application->Terminate();
}
//---------------------------------------------------------------------------

Winform 弹出窗体 - 显示特效

Winform 弹出窗体 - 显示特效
  • sz_bdqn
  • sz_bdqn
  • 2010年08月27日 07:30
  • 577

用C#制作飘动的窗体效果

效果图:最近翻看以前的学习C#的联系代码,无意之中发现一个很有趣的项目。是一个飘动窗体的效果,运行程序之后,在当前屏幕上会像雪花般飘动很多自定义图标,并且它们就像雪花般轻盈地从屏幕上方飘落到屏幕下方,...
  • zhoufoxcn
  • zhoufoxcn
  • 2008年06月06日 09:02
  • 14045

在C#里实现各种窗口切换特效,多达13种特效

预览:            下载          这次clayui给大家带来了比较实用的东西,因为时间比较仓促,就先放出C#版,目前只有13种特效,如果大家对这个比较喜欢的话,请推荐一下,让更...
  • educast
  • educast
  • 2011年06月29日 08:04
  • 1026

winform窗体特效

1.   private   void   Form1_Load(object   sender,   System.EventArgs   e)      for(double   d=0....
  • zhenyuanjie
  • zhenyuanjie
  • 2012年08月07日 09:39
  • 1440

特效集锦

http://www.joelambert.co.uk/flux/   http://www.youku.com/playlist_show/id_17105254.html
  • appteam_vlctech
  • appteam_vlctech
  • 2012年08月03日 16:23
  • 171

winform 窗体特效

上位机启动及关闭的时候,可以利用AnimateWindow函数实现特殊效果,以丰富交互!...
  • jieffantfyan
  • jieffantfyan
  • 2015年08月20日 10:47
  • 271

OpenCV学习笔记(17)双目测距与三维重建的OpenCV实现问题集锦(二)双目定标与双目校正

原文地址:http://blog.csdn.net/chenyusiyuan/article/details/5963256 三、双目定标和双目校正 双目摄像头定标不仅要得出每个摄像头...
  • liuzunyan
  • liuzunyan
  • 2015年06月01日 06:17
  • 1590

Delphi 设置窗体的属性(最前端显示、淡入淡出效果、滑动效果)

//1、淡入淡出效果、滑动效果 procedure TForm1.FormShow(Sender: TObject); begin   //AW_SLIDE:滑动类型  ;AW_BLEND:为淡...
  • xiongmao000738
  • xiongmao000738
  • 2011年09月23日 17:32
  • 3503

C#实现窗体动态传值

实现窗体间的传值,必须获得给窗体及窗体上的控件,才能对其进行下一步的操作。网上流传着有许多窗体传值的方法,也在这上面花费不少的时间,真是感叹互联网信息的多源性!根据具体的实践,采用下面这种窗体传值策略...
  • mm19850110
  • mm19850110
  • 2010年04月25日 18:03
  • 1232

窗体的视图切换效果

从ITOO的2.0 中期开始,勇霞师姐让我尝试着参照Java版的代码将.net的窗体实现类似百度的搜索界面,说起来并不难,今天我来将这个小功能分享给大家:        这个功能主要有两部分:  ...
  • YSC1123
  • YSC1123
  • 2015年03月22日 15:10
  • 1265
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:窗体动态特效集锦
举报原因:
原因补充:

(最多只允许输入30个字)