線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1484
推到 Plurk!
推到 Facebook!

誰能交我如何用bcb寫像電影結束後會捲動的布幕

 
bcb902146
一般會員


發表:67
回覆:33
積分:22
註冊:2002-07-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-08-08 22:01:30 IP:61.70.xxx.xxx 未訂閱
誰能交我如何用bcb寫像電影結束後會捲動的布幕 捲完後自動從下方卷上來 劉維翔
------
劉維翔
lcsboy
版主


發表:87
回覆:622
積分:394
註冊:2002-06-18

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-08-09 09:44:00 IP:61.222.xxx.xxx 未訂閱
我有作過, 但最後失敗了, 不過提出我的看法, 這樣也許有人可以從我的錯誤 中修正, 雖然是動畫中的最簡單技巧, 可是在Windows下, 還要考慮Message的 使用. 所以我才失敗 1.把畫面分成兩個部份, 比如說1:20, 把這兩個部份, 各用BitBlt抓到自己的 兩個Buffer, 可以用TImgae 或TBitmap 2.把那塊畫面先清成空白 3.把比例20的那一部份, 從最上面貼下來, 接著把比例1的部份貼到比例20的下 方, 使用Sleep來作個Delay 4. Repeat step2 & step3 以前Dos下玩, 一定沒問題, 不過現在在Windows下, 還要考慮WM_PAINT和 WM_ERASEBACKGROUND之外, 應該還有別的吧....我都沒處理好Message所以 作出來的畫面會亂掉
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-08-09 13:18:25 IP:61.218.xxx.xxx 未訂閱
引言: 誰能交我如何用bcb寫像電影結束後會捲動的布幕 捲完後自動從下方卷上來 劉維翔
看看這有沒有您要的特效!

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

(作者:孫航東 2000年11月15日 13:11) 資料來源: http://www.ccidnet.com/tech/guide/2000/11/15/58_1313.html 以前,程序員在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<=WideHalf; 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<10000;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<=WideHalf;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<10000;j ); } } 5、在Items3的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item3Click(TObject *Sender) { //圖像從中間往上下分出// Form1->Refresh( ); HeightHAlf=Bittmap1->Height/2 Bitmap1->Height%2; for(i=0;i<=HeightHalf;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<10000;j ); } } 6、在Items4的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item4Click(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 ); } } 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<10000;j ); } } 8、在Items6的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item6Click(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 ); } } 9、在Items7的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item7Click(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<10000;j ); } } 10、在Items8的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item8Click(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 ); } } 11、在Items9的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item9Click(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 ); } } 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<10000;j ); } } 13、在Items11的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item11Click(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 ); } } 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<10000;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<=i;j1 ) { Dest1 =Rect(0 ,j1,Bitmap1->Width 0,j 1); Form1->Canvas->CopyRect(Dest1,Bitmap1->Canvas,Source1); for(j=0;j<10000;j ); } } } 16、在Items14的OnClieck事件中添加如下代碼: void__fastcall TForm1::Item14Click(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 ); } } } 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;iWidth/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 ); } } 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;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 ); } } 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;i<=Bitmap1->Height;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<10000;j ); } } 以上程序在C Builder5.0Enterpriseh和Win98/WinME通過。
時間就是金錢---[ 發問前請先找找舊文章]
SKYSTAR
中階會員


發表:76
回覆:198
積分:64
註冊:2002-06-10

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-03-10 15:57:16 IP:210.66.xxx.xxx 未訂閱
請問大大....    可否煩請會用Delphi的大大們...改寫此一程序呢?    實在是不好意思....我自己不會改寫!! 謝謝囉!!
Cooky Kid
初階會員


發表:5
回覆:68
積分:44
註冊:2002-07-11

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-03-11 18:52:08 IP:211.76.xxx.xxx 未訂閱
引言: 誰能交我如何用bcb寫像電影結束後會捲動的布幕 捲完後自動從下方卷上來
下面是最簡單的捲動布幕,請自行修改.... enjoy it!!!! object Timer1: TTimer Interval = 100 OnTimer = Timer1Timer Left = 40 Top = 24 end object PaintBox1: TPaintBox Left = 80 Top = 16 Width = 281 Height = 185 Color = clLime Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -16 Font.Name = 'MS Sans Serif' Font.Style = [] ParentColor = False ParentFont = False end object Button1: TButton Left = 3 Top = 56 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 0 OnClick = Button1Click end ====================================== unit1.h
class TForm1 : public TForm
{
__published:        // IDE-managed Components
    TTimer *Timer1;
    TPaintBox *PaintBox1;
    TButton *Button1;
    void __fastcall Button1Click(TObject *Sender);
    void __fastcall Timer1Timer(TObject *Sender);
private:        // User declarations
    bool aboutme;//
public:                // User declarations
    __fastcall TForm1(TComponent* Owner);
};
unit1.cpp
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
aboutme=false;
Caption="取消選取";
//讓Timer捲動的快些
Timer1->Interval = 100;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{//三元運算
(aboutme)?(aboutme=false,Caption="取消選取"):(aboutme=true,Caption="確認選取");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
static int y_pos = PaintBox1->Height 180;
if(aboutme==true)
  {
  if (y_pos <= 0) y_pos = PaintBox1->Height 180;
  else y_pos = y_pos - 1;    //PaintBox1->Repaint();//Refresh();
  PaintBox1->Canvas->TextOut(55, y_pos-200, "土法煉鋼之螢幕字幕捲動");
  PaintBox1->Canvas->TextOut(38, y_pos-180, "***************************************");
  PaintBox1->Canvas->TextOut(5, y_pos-160, "Copyright (C)2000, by Cooky Kid Studio");
  PaintBox1->Canvas->TextOut(5, y_pos-140, "All rights reserved                                               .");
  PaintBox1->Canvas->TextOut(5, y_pos-120, "Art & Program by Cooky Kid                                       .");
  PaintBox1->Canvas->TextOut(5, y_pos-100, "Email: CookyKid@cooky.kid.com.tw                                          .");
  PaintBox1->Canvas->TextOut(5, y_pos-80, "Web Site: http://                                                         .");
  PaintBox1->Canvas->TextOut(5, y_pos-60, "This test-program is modified for MyOldLove-JANE only,                                            .");
  PaintBox1->Canvas->TextOut(5, y_pos-40, "and blessing everyday in a joyous spirit.                                    .");
  PaintBox1->Canvas->TextOut(5, y_pos-20, "Enjoy it! :-)                                                               .");
  PaintBox1->Canvas->TextOut(5, y_pos, "                                                                                   .");
  }
else
  y_pos = PaintBox1->Height 180;
}
//---------------------------------------------------------------------------
 
人生就像是盒中的巧克力,除非你試了,要不然,你永遠都不知道它是什麼樣的口味。--阿甘正傳
系統時間:2024-05-02 14:05:21
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!