| 订阅 | 在线投稿
分享
 
 
 

用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=http://www.wangchao.net.cn/bbsdetail_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=http://www.wangchao.net.cn/bbsdetail_1785121.html][img]http://image.wangchao.net.cn/it/1323424647637.gif[/img][/url] 更多内容请看C/C++技术专题 C/C++相关文章 Wlan组网----家庭专题专题,或
󰈣󰈤
 
 
 
>>返回首页<<
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 
 热帖排行
 
 
王朝网络微信公众号
微信扫码关注本站公众号wangchaonetcn
 
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有