| 導購 | 订阅 | 在线投稿
分享
 
 
 

用C++ 開發特殊的屏幕顯示效果

2008-06-01 01:58:54  編輯來源:互聯網  简体版  手機版  移動版  評論  字體: ||

以前,程序員在DOS平台下開發應用軟件時,都會利用DOS的開放性特點,通過中斷編寫出一些非凡的顯示效果,以此來給自己的程序增加一些有趣的特色。

然而,隨著面向Windows的編程和可視化的第四代開發工具的逐步使用,人們越來越被Windows的統一的編程風格所束縛,同時由于Windows直接治理中斷,想用原來的方法來實現一些非凡的顯示效果變得越來越困難了。

那麽,在Windows時代程序員如何來實現窗口的非凡效果呢?實際上,由于整個Windows是圖形顯示系統,因此對系統而言,用戶程序的每一個界面、窗口都是系統的一個畫布。程序員可以利用這一特點來實現窗口的非凡效果。

最近筆者利用C++ Builder 5.0 EnterPRise成功的實現了該項功能,現介紹如下:

1、在BCB中建立一個工程文件project1.dpr,在Form1中添加如下控件:

控件名稱 屬性 值

TForm Color clBTnText

TMainMenu NameMainMneu1

TImage Name Image1

Align alClient

AutoSize True

同時在 MainMenu1控件中增加一個菜單項,其屬性爲:

Name Caption

Items1 圖像從中間往左右分出

Items2 圖像從左右往中間合進

Items3 圖像從中間往上下分出

Items4 圖像從上下往中間合進

Items5 圖像從左移入

Items6 圖像從右移入

Items7 圖像從上移入

Items8 圖像從下移入

Items9 圖像從左刷屏顯示

Items10圖像從右刷屏顯示

Items11圖像從上刷屏顯示

Items12圖像從下刷屏顯示

Items13圖像從上往下流水

Items14圖像從下往上流水

Items15圖像圓形展出

Items16圖像左右錯移

Items17圖像上下錯移

同時在Unit.cpp中的private中添加如下變量:

private:

BITMAP bm;

Graphics::TBitmap *Bitmap1;

int i,j;

int WideHalf;

TRect Dest1,Source1,Dest2,Source2;

int HeightHalf;

HRGN MyRgn;

2、在Form1的OnCreate事件中添加如下代碼:

void __fastcall TForm1::FormCreate(TObject *Sender)//進行圖像特效顯示的初始化操作//

{

Graphics::TBitmap *Bitmap1 = new Graphics::TBitmap();//定義一個圖象句柄//

Bitmap1-LoadFromFile("C:\\factory.bmp");//設定所要特效顯示的圖象爲factory.bmp//

if(GetDeviceCaps(Form1-Canvas-Handle,BITSPIXEL)==8)//取得顯示窗口的顔色屬性//

{

GetObject(Bitmap1-Handle,sizeof(BITMAP),(LPSTR)&bm);

if (bm.bmBitsPixel==8)//假如特效顯示的圖象顔色屬性爲256色//

{

SelectPalette(Form1-Canvas-Handle,Bitmap1-Palette,FALSE);//從特效顯示的顔色畫板中提取配色方案//

RealizePalette(Form1-Canvas-Handle); //在顯示窗口中設置配色方案//

}

Bitmap-HandleType=bmDDB;

}

}

3、在Items1的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item1Click(TObject *Sender)

{//圖象從中間往左右分出//

Form1-Refresh( );

WideHalf=Bitmap1-Width/2+Bitmap1-Width%2;

for(i=0;i

{

Dest1=Rect(WideHalf-i,0,WideHalf+i,Bitmap1-Height);

Source1=Rect(WideHalf-i,0,WideHalf+i,Bitmap1-Height);

Form1-Canvas-CopyRect(Dest1,Bitmap1-Canvas,Source1);

for(j=0;j

}

}

4、在Items2的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item2Click(TObject *Sender)

{ //圖像從左右往中間合進//

Form1-Refresh( );

WideHalf=Bitmap1-Width/2+Bitmap1-Width%2;

Form1-Refresh( );

for(i=0;i

{

Source1=Dest1=Rect(0,0,i,Bitmap1-Height);

Source2=Dest2=Rect(Bitmap1-Width-i,0,Bitmap-Width,Bitmap1-Height);

Form1-Canvas-CopyRect(Dest1,Bimap1-Canvas,Source1);

Form1-Canvas-CopyRect(Dest2,Bitmap1-Canvas,Source2);

for(j=0;j

}

}

5、在Items3的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item3Click(TObject *Sender)

{ //圖像從中間往上下分出//

Form1-Refresh( );

HeightHAlf=Bittmap1-Height/2+Bitmap1-Height%2;

for(i=0;i

{

Dest1=Rect(0,HeightHalf-i,Bitmap1-Width,HeightHalf);

Source1=Rect(0,0,BmpHandle-Width,i);

Dest2=Rect(0,HeightHaf,Bitmap1-Width,HeightHalf+i);

Source2=Rect(0,Bitmap1-Height-i,Bitmap1-Width,Bitmap1-height);

Form1-Canvas-CopyRect(Dest1,BmpHandle-Canvas,Source1);

Form1-Canvas-CopyRect(Dest2,BmpHandle-Canvas,Source2);

for(j=0;j

}

}

6、在Items4的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item4Click(TObject *Sender)

{ //圖像從上下往中間合進//

Form1-Refresh( );

HeightHalf=Bitmap1-Height/2+Bitmap1-Height%2;

for(i=0;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

}

} (未完)

用C++ 開發特殊的屏幕顯示效果
更多內容請看C/C++技術專題 C/C++相關文章 Wlan組網----家庭專題專題,或

7、在Items5的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item5Click(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

}

}

8、在Items6的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item6Click(TObject *Sender)

{//圖像從右移入//

Form1-Refresh( );

for(i=0;iWidth;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

}

}

9、在Items7的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item7Click(TObject *Sender)

{ //圖像從上移入//

Form1-Refresh( );

for(i=0;iHeight;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

}

}

10、在Items8的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item8Click(TObject *Sender)

{ //圖像從下移入//

Form1-Refresh( );

for(i=0;iHeight;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

}

}

11、在Items9的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item9Click(TObject *Sender)

{ //圖像從左刷屏顯示//

Form1-Refresh( );

for(i=0;iWidth;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

}

}

12、在Items10的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item10Click(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

}

}

13、在Items11的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item11Click(TObject *Sender)

{ //圖像從上刷屏顯示//

Form1-Refresh( );

for(i=0;iHeight;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

}

}

14、在Items12的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item12Click(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

}

}

15、在Items13的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item13Click(TObject *Sender)

{ //圖像從上往下流水//

Form1-Refresh( );

for(i=Bitmap1-Height;i=0;i--)

{

Source1 =Rect(0,i,Bitmap1-Width,i+1);

for(int j1=0;j1

{

Dest1 =Rect(0 ,j1,Bitmap1-Width+0,j+1);

Form1-Canvas-CopyRect(Dest1,Bitmap1-Canvas,Source1);

for(j=0;j

}

}

}

16、在Items14的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item14Click(TObject *Sender)

{//圖像從下往上流水//

Form1-Refresh( );

for(i=0;iHeight;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

}

}

}

17、在Items15的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item15Click(TObject *Sender)

{ //圖像圓形展出//

Form1-Refresh( );

int j1=sqrt(Bitmap1-Width*Bitmap1-Width+

Bitmap1-Height*Bitmap1-Height)/2+4;

for (i=1;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

}

}

18、在Items16的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item16Click(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;iWidth;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

}

}

19、在Items17的OnClieck事件中添加如下代碼:

void__fastcall TForm1::Item17Click(TObject *Sender)

{//圖像上下錯移//

Form1-Refresh( );

WideHalf=Bitmap1-Width/2+Bitmap1-Width%2;

Source1=Rect(0,0,WideHalf,Bitmap1-Height);

Source2=Rect(WideHalf,0,Bitmap1-Width,Bitmap1-Height);

for(i=0;iHeight;i++)

{

Dest1=Rect(0,0-Bitmap1-Height+i,WideHalf,0+i);

Dest2=Rect(WideHalf,

Bitmap1-Height-i,

Bitmap1-Width,

Bitmap1-Height+Bitiap1(Ighdht)k-; &'Biym1-Canvas-MoveTo(0,0-Bitmap1-Height+i-1);

Form1-Canvas-LineTo(WideHalf,

0-Bitmap1-Height+i-1);

Form1-Canvas-CopyRect(Dest1,Bitmap1-Canvas,Source1);

Form1-Canvas-MoveTo(WideHalf,

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

}

}

以上程序在C++ Builder5.0Enterpriseh和Win98/WinME通過。

用C++ 開發特殊的屏幕顯示效果
更多內容請看C/C++技術專題 C/C++相關文章 Wlan組網----家庭專題專題,或

  以前,程序員在DOS平台下開發應用軟件時,都會利用DOS的開放性特點,通過中斷編寫出一些非凡的顯示效果,以此來給自己的程序增加一些有趣的特色。 然而,隨著面向Windows的編程和可視化的第四代開發工具的逐步使用,人們越來越被Windows的統一的編程風格所束縛,同時由于Windows直接治理中斷,想用原來的方法來實現一些非凡的顯示效果變得越來越困難了。   那麽,在Windows時代程序員如何來實現窗口的非凡效果呢?實際上,由于整個Windows是圖形顯示系統,因此對系統而言,用戶程序的每一個界面、窗口都是系統的一個畫布。程序員可以利用這一特點來實現窗口的非凡效果。   最近筆者利用C++ Builder 5.0 EnterPRise成功的實現了該項功能,現介紹如下:   1、在BCB中建立一個工程文件project1.dpr,在Form1中添加如下控件:    控件名稱           屬性         值    TForm             Color       clBTnText    TMainMenu           Name        MainMneu1    TImage             Name         Image1                   Align       alClient                   AutoSize       True   同時在 MainMenu1控件中增加一個菜單項,其屬性爲:    Name             Caption    Items1           圖像從中間往左右分出    Items2           圖像從左右往中間合進    Items3           圖像從中間往上下分出    Items4           圖像從上下往中間合進    Items5           圖像從左移入    Items6           圖像從右移入    Items7           圖像從上移入    Items8           圖像從下移入    Items9           圖像從左刷屏顯示    Items10          圖像從右刷屏顯示    Items11          圖像從上刷屏顯示    Items12          圖像從下刷屏顯示    Items13          圖像從上往下流水    Items14          圖像從下往上流水    Items15          圖像圓形展出    Items16          圖像左右錯移    Items17          圖像上下錯移   同時在Unit.cpp中的private中添加如下變量:   private:    BITMAP bm;    Graphics::TBitmap *Bitmap1;    int i,j;    int WideHalf;    TRect Dest1,Source1,Dest2,Source2;   int HeightHalf;   HRGN MyRgn;   2、在Form1的OnCreate事件中添加如下代碼:   void __fastcall TForm1::FormCreate(TObject *Sender)//進行圖像特效顯示的初始化操作//   {           Graphics::TBitmap *Bitmap1 = new Graphics::TBitmap();//定義一個圖象句柄//      Bitmap1-LoadFromFile("C:\\factory.bmp");//設定所要特效顯示的圖象爲factory.bmp//      if(GetDeviceCaps(Form1-Canvas-Handle,BITSPIXEL)==8)//取得顯示窗口的顔色屬性//      {       GetObject(Bitmap1-Handle,sizeof(BITMAP),(LPSTR)&bm);       if (bm.bmBitsPixel==8)//假如特效顯示的圖象顔色屬性爲256色//       {        SelectPalette(Form1-Canvas-Handle,Bitmap1-Palette,FALSE);//從特效顯示的顔色畫板中提取配色方案//        RealizePalette(Form1-Canvas-Handle); //在顯示窗口中設置配色方案//       }       Bitmap-HandleType=bmDDB;        }      }       3、在Items1的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item1Click(TObject *Sender)   {      //圖象從中間往左右分出//   Form1-Refresh( );   WideHalf=Bitmap1-Width/2+Bitmap1-Width%2;   for(i=0;i    {    Dest1=Rect(WideHalf-i,0,WideHalf+i,Bitmap1-Height);    Source1=Rect(WideHalf-i,0,WideHalf+i,Bitmap1-Height);    Form1-Canvas-CopyRect(Dest1,Bitmap1-Canvas,Source1);    for(j=0;j   }    }   4、在Items2的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item2Click(TObject *Sender)   {                   //圖像從左右往中間合進//   Form1-Refresh( );    WideHalf=Bitmap1-Width/2+Bitmap1-Width%2;    Form1-Refresh( );    for(i=0;i    {    Source1=Dest1=Rect(0,0,i,Bitmap1-Height);    Source2=Dest2=Rect(Bitmap1-Width-i,0,Bitmap-Width,Bitmap1-Height);    Form1-Canvas-CopyRect(Dest1,Bimap1-Canvas,Source1);    Form1-Canvas-CopyRect(Dest2,Bitmap1-Canvas,Source2);    for(j=0;j    }   }   5、在Items3的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item3Click(TObject *Sender)   {           //圖像從中間往上下分出//   Form1-Refresh( );    HeightHAlf=Bittmap1-Height/2+Bitmap1-Height%2;    for(i=0;i    {    Dest1=Rect(0,HeightHalf-i,Bitmap1-Width,HeightHalf);    Source1=Rect(0,0,BmpHandle-Width,i);    Dest2=Rect(0,HeightHaf,Bitmap1-Width,HeightHalf+i);    Source2=Rect(0,Bitmap1-Height-i,Bitmap1-Width,Bitmap1-height);    Form1-Canvas-CopyRect(Dest1,BmpHandle-Canvas,Source1);    Form1-Canvas-CopyRect(Dest2,BmpHandle-Canvas,Source2);    for(j=0;j    }   }   6、在Items4的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item4Click(TObject *Sender)   {                 //圖像從上下往中間合進//   Form1-Refresh( );    HeightHalf=Bitmap1-Height/2+Bitmap1-Height%2;    for(i=0;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    }   } (未完) [url=/bbs/detail_1785121.html][img]http://image.wangchao.net.cn/it/1323424647571.gif[/img][/url] 更多內容請看C/C++技術專題 C/C++相關文章 Wlan組網----家庭專題專題,或   7、在Items5的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item5Click(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    }   }   8、在Items6的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item6Click(TObject *Sender)   {                        //圖像從右移入//    Form1-Refresh( );   for(i=0;iWidth;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    }   }   9、在Items7的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item7Click(TObject *Sender)   {                       //圖像從上移入//   Form1-Refresh( );   for(i=0;iHeight;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    }   }   10、在Items8的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item8Click(TObject *Sender)   {                       //圖像從下移入//   Form1-Refresh( );    for(i=0;iHeight;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    }     }   11、在Items9的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item9Click(TObject *Sender)   {                       //圖像從左刷屏顯示//   Form1-Refresh( );   for(i=0;iWidth;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   }    }   12、在Items10的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item10Click(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    }   }   13、在Items11的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item11Click(TObject *Sender)   {                     //圖像從上刷屏顯示//   Form1-Refresh( );    for(i=0;iHeight;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   }   }   14、在Items12的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item12Click(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    }   }   15、在Items13的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item13Click(TObject *Sender)   {                   //圖像從上往下流水//   Form1-Refresh( );   for(i=Bitmap1-Height;i=0;i--)    {    Source1 =Rect(0,i,Bitmap1-Width,i+1);    for(int j1=0;j1    {    Dest1 =Rect(0 ,j1,Bitmap1-Width+0,j+1);    Form1-Canvas-CopyRect(Dest1,Bitmap1-Canvas,Source1);    for(j=0;j    }    }   }   16、在Items14的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item14Click(TObject *Sender)   {                    //圖像從下往上流水//   Form1-Refresh( );    for(i=0;iHeight;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    }    }   }   17、在Items15的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item15Click(TObject *Sender)   {                   //圖像圓形展出//   Form1-Refresh( );    int j1=sqrt(Bitmap1-Width*Bitmap1-Width+        Bitmap1-Height*Bitmap1-Height)/2+4;    for (i=1;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    }   }   18、在Items16的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item16Click(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;iWidth;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    }   }   19、在Items17的OnClieck事件中添加如下代碼:   void__fastcall TForm1::Item17Click(TObject *Sender)   {                    //圖像上下錯移//    Form1-Refresh( );   WideHalf=Bitmap1-Width/2+Bitmap1-Width%2;    Source1=Rect(0,0,WideHalf,Bitmap1-Height);    Source2=Rect(WideHalf,0,Bitmap1-Width,Bitmap1-Height);    for(i=0;iHeight;i++)    {    Dest1=Rect(0,0-Bitmap1-Height+i,WideHalf,0+i);    Dest2=Rect(WideHalf,          Bitmap1-Height-i,          Bitmap1-Width,          Bitmap1-Height+Bitiap1(Ighdht)k-;   &'Biym1-Canvas-MoveTo(0,0-Bitmap1-Height+i-1);    Form1-Canvas-LineTo(WideHalf,                    0-Bitmap1-Height+i-1);    Form1-Canvas-CopyRect(Dest1,Bitmap1-Canvas,Source1);    Form1-Canvas-MoveTo(WideHalf,                    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   }   } 以上程序在C++ Builder5.0Enterpriseh和Win98/WinME通過。 [url=/bbs/detail_1785121.html][img]http://image.wangchao.net.cn/it/1323424647637.gif[/img][/url] 更多內容請看C/C++技術專題 C/C++相關文章 Wlan組網----家庭專題專題,或
󰈣󰈤
王朝萬家燈火計劃
期待原創作者加盟
 
 
 
>>返回首頁<<
 
 
 
 
 熱帖排行
 
王朝網路微信公眾號
微信掃碼關註本站公眾號 wangchaonetcn
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有