屏保自己做
因需要根據(jù)不同星期自動調(diào)用不同屏保圖片,自己動手做了一個
代碼如下:
//主工程文件 program scrsave;usesForms,Unit1 in 'Unit1.pas' {Form1};{$R *.res}beginApplication.Initialize;Application.Title := '橫店屏保一';Application.CreateForm(TForm1, Form1);Application.Run; end.//單元文件 unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, ExtCtrls, StdCtrls, JPEG;typeTForm1 = class(TForm)Timer1: TTimer;procedure FormDestroy(Sender: TObject);procedure FormCreate(Sender: TObject);procedure FormShow(Sender: TObject);procedure Timer1Timer(Sender: TObject);procedure LoadImage(img: TBitmap; cFile: String);procedure FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);procedure FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);privateprocedure FindFiles(sPath: string);procedure Detect(var Msg: TMsg; var Handled: Boolean);procedure BackClear;//清屏procedure HundredLeaf(cFile: string); //百葉窗procedure PushDrag(cFile: string);//推拉procedure HorizonCross(cFile: string);//水平交錯procedure VericalCross(cFile: string);//垂直交錯procedure PutStick(cFile: string); //積木procedure CenToAll(cFile: string);//中間到四周procedure AllToCen(cFile: string);procedure LUpToRDown(cFile: string);//左上到右下procedure RDownToLUp(cFile: string);//右下到左上procedure LDownToRUp(cFile: string);//左下到右上procedure RUpToLDown(cFile: string);//右上到左下procedure MidToBoth(cFile: string);//中間到兩邊procedure BothToMid(cFile: string);//兩邊到中間procedure FlowSand(cFile: string);//流沙{ Private declarations }public{ Public declarations }end;varForm1: TForm1;FilesList: TStringList;sFilePath: string;Stop: boolean;implementation //{$D ScreenSave 我的屏幕保護(hù)}{$R *.dfm}procedure TForm1.FormDestroy(Sender: TObject); beginFilesList.Free; end;procedure TForm1.FormCreate(Sender: TObject); varweek: Integer; beginself.Color := clBlack;Stop := False;//按星期選擇相應(yīng)的文件夾week := DayOfWeek(Date());case week of1,2: sFilePath := ExtractFilePath(Application.ExeName)+'Hdds\monday';3: sFilePath := ExtractFilePath(Application.ExeName)+'Hdds\tuesday';4: sFilePath := ExtractFilePath(Application.ExeName)+'Hdds\wendsday';5: sFilePath := ExtractFilePath(Application.ExeName)+'Hdds\thursday';6,7: sFilePath := ExtractFilePath(Application.ExeName)+'Hdds\friday';end;FindFiles(sFilePath);//Self.FormStyle := fsStayOnTop; end;procedure Tform1.FindFiles(sPath: string); function FType(cFile: String): boolean; vark :integer;ext: string; beginresult := false;if Length(cFile) > 2 thenbegink := pos('.',cFile);ext := UpperCase(copy(cFile,k,length(cFile)-k+1));if (ext= '.JPEG') or (ext= '.JPG') or (ext= '.BMP') thenresult := true;end; end; varSearchRec: TSearchRec; beginif not Assigned(FilesList) then FilesList:= TStringList.Create;FilesList.Clear;if FindFirst(sPath+'\*.*', 0, SearchRec)=0 thenbegintryrepeatif FType(SearchRec.Name) thenbeginFilesList.Add(sPath+'\'+SearchRec.Name);end;until FindNext(SearchRec)<>0;exceptFindClose(SearchRec);raise;end;FindClose(SearchRec);end; end;procedure TForm1.Detect(var Msg: TMsg; var Handled: Boolean); beginif (Msg.message = wm_keydown) or (Msg.message = wm_lbuttondown) or(Msg.message = wm_rbuttondown)thenbeginstop := true;Timer1.Enabled := True;close;end; end;procedure TForm1.FormShow(Sender: TObject); beginWindowState := wsMaximized;Self.BringToFront;ShowCursor(False);Application.OnMessage := Detect; end;//百葉窗效果 procedure TForm1.HundredLeaf(cFile: string); varBitTemp1,BitTemp2,Bitmap:TBitmap;i,j,bmpheight,bmpwidth:integer;xgroup,xcount:integer; beginBitTemp1:= TBitmap.Create;//過渡位圖BitTemp2:= TBitmap.Create;Bitmap := TBitmap.Create;BackClear;tryLoadImage(BitTemp1, cFile);BitTemp2.Width := self.Width;BitTemp2.Height := self.Height;BitTemp2.Canvas.StretchDraw(ClientRect, BitTemp1);Bitmap.Width := self.Width;Bitmap.Height := self.Height;bmpheight:=Height;bmpwidth:=Width;xgroup:=10;xcount:=bmpheight div xgroup;for i:=0 to xcount dofor j:=0 to xgroup dobeginsleep(10);Bitmap.Canvas.CopyRect(Rect(0,xcount*j+i-1,bmpwidth,xcount*j+i),BitTemp2.Canvas,Rect(0,xcount*j+i-1,bmpwidth,xcount*j+i)); self.Canvas.Draw(0,0,Bitmap);Application.ProcessMessages;if Stop then Exit;end;finallyBitmap.Free;BitTemp1.Free;BitTemp2.Free;end; end;//========================================================= //推拉效果 //========================================================== procedure TForm1.PushDrag(cFile: string); varBitTemp1,BitTemp2:TBitmap;//Bitmap:TBitmap;i,bmpheight,bmpwidth:integer; beginBackClear; //清屏BitTemp1:= TBitmap.Create;//過渡位圖BitTemp2:= TBitmap.Create;//Bitmap := TBitmap.Create;tryLoadImage(BitTemp1, cFile);BitTemp2.Width := self.Width;BitTemp2.Height := self.Height;BitTemp2.Canvas.StretchDraw(ClientRect, BitTemp1);//Bitmap.Width := self.Width;// Bitmap.Height := self.Height;bmpheight:=Height;bmpwidth:=Width;for i:=0 to bmpheight dobegin{Bitmap.Canvas.CopyRect(Rect(0,bmpheight-i,bmpwidth,bmpheight),BitTemp2.Canvas,Rect(0,0,bmpwidth,i));self.Canvas.Draw(0,0,Bitmap,); }BitBlt(Self.Canvas.Handle,0,bmpheight-i,bmpwidth,bmpheight,BitTemp2.Canvas.Handle,0,0,srcCopy);Application.ProcessMessages;if Stop then Exit;end;finally// Bitmap.Free;BitTemp1.Free;BitTemp2.Free;end; end;//============================================================== //水平交錯 //============================================================== procedure TForm1.HorizonCross(cFile: string); varBitTemp1,BitTemp2,Bitmap:TBitmap;i,j,bmpheight,bmpwidth:integer; begin//BackClear(cFile); //清屏BitTemp1:= TBitmap.Create;//過渡位圖BitTemp2:= TBitmap.Create;Bitmap := TBitmap.Create;tryLoadImage(BitTemp1, cFile);BitTemp2.Width := self.Width;BitTemp2.Height := self.Height;BitTemp2.Canvas.StretchDraw(ClientRect, BitTemp1);Bitmap.Width := self.Width;Bitmap.Height := self.Height;bmpheight:=Height;bmpwidth:=Width;i:=0;while i<=bmpwidth dobeginj:=i;while j >0 dobeginBitmap.Canvas.CopyRect(Rect(j-1,0,j,bmpheight),BitTemp2.Canvas,Rect(bmpwidth-i+j-1,0,bmpwidth-i+j,bmpheight));Bitmap.Canvas.CopyRect(Rect(bmpwidth-j-1,0,bmpwidth-j,bmpheight),BitTemp2.Canvas,Rect(i-j,0,i-j+1,bmpheight));j:=j-3;Application.ProcessMessages;if Stop then Exit;end;Application.ProcessMessages;if Stop then Exit;self.Canvas.Draw(0,0,Bitmap);inc(i,3);end;Bitmap.Canvas.CopyRect(rect(0,0,Width,Height),BitTemp2.Canvas,rect(0,0,Width,Height));self.Canvas.Draw(0,0,Bitmap);sleep(500);finallyBitmap.Free;BitTemp1.Free;BitTemp2.Free;end; end;//======================================================================= //垂直交錯 //======================================================================== procedure TForm1.VericalCross(cFile: string); varBitTemp1,BitTemp2,Bitmap:TBitmap;i,j,bmpheight,bmpwidth:integer; beginBackClear; //清屏BitTemp1:= TBitmap.Create;//過渡位圖BitTemp2:= TBitmap.Create;Bitmap := TBitmap.Create;tryLoadImage(BitTemp1, cFile);BitTemp2.Width := self.Width;BitTemp2.Height := self.Height;BitTemp2.Canvas.StretchDraw(ClientRect, BitTemp1);Bitmap.Width := self.Width;Bitmap.Height := self.Height;bmpheight:=Height;bmpwidth:=Width;i:=0;while i<=bmpheight dobeginj:=i;while j >0 dobeginBitmap.Canvas.CopyRect(Rect(0,j-1,bmpwidth,j),BitTemp2.Canvas,Rect(0,bmpheight-i+j-1,bmpwidth,bmpheight-i+j));Bitmap.Canvas.CopyRect(Rect(0,bmpheight-j-1,bmpwidth,bmpheight-j),BitTemp2.Canvas,Rect(0,i-j,bmpwidth,i-j+1));j:=j-3;Application.ProcessMessages;if Stop then Exit;end;Application.ProcessMessages;if Stop then Exit;self.Canvas.Draw(0,0,Bitmap);i:=i+3;end;Bitmap.Canvas.CopyRect(rect(0,0,Width,Height),BitTemp2.Canvas,rect(0,0,Width,Height));self.Canvas.Draw(0,0,Bitmap);sleep(500);finallyBitmap.Free;BitTemp1.Free;BitTemp2.Free;end; end;//=========================================================================== //積木效果 //=========================================================================== procedure TForm1.PutStick(cFile: string); varBitTemp1,BitTemp2,Bitmap:TBitmap;i,j,x,y:integer; beginBitTemp1:= TBitmap.Create;//過渡位圖BitTemp2:= TBitmap.Create;Bitmap := TBitmap.Create;tryLoadImage(BitTemp1, cFile);BitTemp2.Width := self.Width;BitTemp2.Height := self.Height;BitTemp2.Canvas.StretchDraw(ClientRect, BitTemp1);Bitmap.Width := self.Width;Bitmap.Height := self.Height;self.Color := clBlack;i := 0;j := 0;for x:=0 to 20 dobeginfor y:=0 to 15 dobeginBitmap.Canvas.CopyRect(rect(i*50,j*50,(i+1)*50,(j+1)*50),BitTemp2.Canvas,rect(i*50,j*50,(i+1)*50,(j+1)*50));self.Canvas.Draw(0,0,Bitmap);i:=i+2;Application.ProcessMessages;if Stop then Exit;end;j:=j+2;i:=0;end;j:=1;i:=1;for x:=0 to 20 dobeginfor y:=0 to 15 dobeginBitmap.Canvas.CopyRect(rect(i*50,j*50,(i+1)*50,(j+1)*50),BitTemp2.Canvas,rect(i*50,j*50,(i+1)*50,(j+1)*50));self.Canvas.Draw(0,0,Bitmap);i:=i+2;Application.ProcessMessages;if Stop then Exit;end;j:=j+2;i:=1;end;i := 0;j := 0;for x:=0 to 20 dobeginfor y:=0 to 15 dobeginBitmap.Canvas.CopyRect(rect(i*50,(j+1)*50,(i+1)*50,(j+2)*50),BitTemp2.Canvas,rect(i*50,(j+1)*50,(i+1)*50,(j+2)*50));self.Canvas.Draw(0,0,Bitmap);i:=i+2;Application.ProcessMessages;if Stop then Exit;end;j:=j+2;i:=0;end;j:=1;i:=1;for x:=0 to 20 dobeginfor y:=0 to 15 dobeginBitmap.Canvas.CopyRect(rect(i*50,(j-1)*50,(i+1)*50,j*50),BitTemp2.Canvas,rect(i*50,(j-1)*50,(i+1)*50,j*50));self.Canvas.Draw(0,0,Bitmap);i:=i+2;Application.ProcessMessages;if Stop then Exit;end;j:=j+2;i:=1;end;finallyBitmap.Free;BitTemp1.Free;BitTemp2.Free;end; end;procedure TForm1.Timer1Timer(Sender: TObject); vari,j : Integer; beginTimer1.Enabled := False;Randomize;i := 0;while not stop dobeginj := 1+Random(13);case j of1: HundredLeaf(FilesList.Strings[i]);2: PushDrag(FilesList.Strings[i]);//推拉3: HorizonCross(FilesList.Strings[i]);//水平交錯4: VericalCross(FilesList.Strings[i]);//垂直交錯5: PutStick(FilesList.Strings[i]); //積木6: CenToAll(FilesList.Strings[i]); //中心到四周7: AllToCen(FilesList.Strings[i]);8: LUpToRDown(FilesList.Strings[i]);//左上到右下9: RDownToLUp(FilesList.Strings[i]);//右下到左上10: LDownToRUp(FilesList.Strings[i]);//左下到右上11: RUpToLDown(FilesList.Strings[i]);//右上到左下12: MidToBoth(FilesList.Strings[i]);//中間到兩邊13: BothToMid(FilesList.Strings[i]);//兩邊到中間14: FlowSand(FilesList.Strings[i]);//流沙end;Sleep(2000);if stop thenbeginTimer1.Enabled := True;exit;end;inc(i);if i >= FilesList.Count then i := 0;end; //whileend;procedure TForm1.LoadImage(img: TBitmap; cFile: String); varext: String;jpgimg: TJpegImage;beginext := ExtractFileExt(cFile);if (UpperCase(ext) = '.JPG') or (UpperCase(ext) = '.JPEG') thenbeginjpgimg := TJpegImage.Create;tryjpgimg.LoadFromFile(cFile);img.Assign(jpgimg);finallyjpgimg.Free;end;endelse img.LoadFromFile(cFile); end;procedure TForm1.BackClear;//清黑屏 conststep = 100; varBitTemp, Bitmap : TBitmap;i : integer; begin // self.color := clBlack; // repaint;BitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;LoadImage(BitTemp, ExtractFilePath(Application.ExeName) + 'Hdds\Monday\Back.bmp');//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;//Bitmap.Canvas.Brush.Color := clBlack;Bitmap.Canvas.StretchDraw(ClientRect, BitTemp);for i := 1 to step doBitBlt(self.Canvas.Handle,0,step-i,Width,Height,Bitmap.Canvas.Handle,0,0,blackness);Bitmap.Free; //釋放位圖BitTemp.Free; end;procedure TForm1.CenToAll(cFile: string);//中間到四周 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;X0,Y0:integer;i,MidX,MidY:integer;RatioX,RatioY:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);x0:=width div 2;y0:=height div 2;ratiox:=Bitmap.width/step; //step每加1,圖片變化的寬度ratioy:=Bitmap.height/step;for i:=0 to step dobeginmidx:=round(ratiox*i*0.5);midy:=round(ratioy*i*0.5);bitblt(self.canvas.handle,x0-midx,y0-midy,round(ratiox*i),round(ratioy*i),bitmap.canvas.handle,x0-midx,y0-midy,srccopy);//循環(huán)拷貝一定區(qū)域的圖象顯示,區(qū)域不斷變化實(shí)現(xiàn)特效顯示Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.AllToCen(cFile: string);//四周到中間 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;i :integer;RatioX,RatioY:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);ratiox:=width/step;ratioy:=height/step;for i:= 0 to step dobegin //由于bitblt每次只能拷貝一個矩形,故要實(shí)現(xiàn)//從四周到中間的漸變顯示特效,需要每次拷貝周邊的//四個矩形,組成一個矩形框,bitblt(self.canvas.handle,0,0,round(ratiox*i*0.5),height,bitmap.canvas.handle,0,0,srccopy);//拷貝左邊的矩形bitblt(self.canvas.handle,0,0,width,round(ratioy*i*0.5),bitmap.canvas.handle,0,0,srccopy);//拷貝上方的矩形bitblt(self.canvas.handle,width-round(ratiox*i*0.5),0,width,height,bitmap.canvas.handle,width-round(ratiox*i*0.5),0,srccopy);//拷貝右邊的矩形bitblt(self.canvas.handle,0,height-round(ratioy*i*0.5),width,height,bitmap.canvas.handle,0,height-round(ratioy*i*0.5),srccopy);//拷貝下面的矩形Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.LUpToRDown(cFile: string);//左上到右下 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;i:integer;RatioX,RatioY:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);ratiox:=width/step;ratioy:=height/step;for i:= 0 to step dobeginbitblt(self.canvas.handle,0,0,round(ratiox*i),round(ratioy*i),bitmap.canvas.handle,0,0,srccopy);//拷貝左上角的一個矩形,要求右下角的坐標(biāo)//按(round(ratiox*i),round(ratioy*i))變化,//注意,由于寬和高不等,所以它們的變化幅度//也應(yīng)該有所不同。Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.RDownToLUp(cFile: string);//右下到左上 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;i:integer;RatioX,RatioY:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);ratiox:=width/step;ratioy:=height/step;for i:= 0 to step dobeginbitblt(self.canvas.handle,width-round(ratiox*i),height-round(ratioy*i),width,height,bitmap.canvas.handle,width-round(ratiox*i),height-round(ratioy*i),srccopy);Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.LDownToRUp(cFile: string);//左下到右上 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;i:integer;RatioX,RatioY:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);ratiox:=width/step;ratioy:=height/step;for i:= 0 to step dobeginbitblt(self.canvas.handle,0,height-round(ratioy*i),round(ratiox*i),height,bitmap.canvas.handle,0,height-round(ratioy*i),srccopy);Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.RUpToLDown(cFile: string);//右上到左下 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;i:integer;RatioX,RatioY:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);ratiox:=width/step;ratioy:=height/step;for i:= 0 to step dobeginbitblt(self.canvas.handle,width-round(ratiox*i),0,width,round(ratioy*i),bitmap.canvas.handle,width-round(ratiox*i),0,srccopy);Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.MidToBoth(cFile: string);//中間到兩邊 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;i:integer;RatioX:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);RatioX:=width/step;for i:= 0 to step dobegin//注意此時左上角的x坐標(biāo)朝左變化,而右下角的x坐標(biāo)朝右變化bitblt(self.canvas.handle,round(width/2)-round(ratiox*i*0.5),0,round(ratiox*i),height,bitmap.canvas.handle,round(width/2)-round(ratiox*i*0.5),0,srccopy);Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.BothToMid(cFile: string);//兩邊到中間 constStep=1600; //循環(huán)的次數(shù),用以調(diào)整圖象變動的快慢 varBitmap, BitTemp:TBitmap;i:integer;RatioX:real; beginBitTemp := TBitmap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp, cFile);//載入圖片Bitmap.Width := self.Width;Bitmap.Height := self.Height;Bitmap.Canvas.StretchDraw(self.ClientRect, BitTemp);ratiox:=width/step;for i:= 0 to step dobegin//實(shí)際是從四周到中心變化的簡化。bitblt(self.canvas.handle,0,0,round(ratiox*i*0.5),height,bitmap.canvas.handle,0,0,srccopy);bitblt(self.canvas.handle,width-round(ratiox*i*0.5),0,width,height,bitmap.canvas.handle,width-round(ratiox*i*0.5),0,srccopy);Application.ProcessMessages;if Stop then Exit;end;finallybitmap.free; //釋放位圖BitTemp.Free;end; end;procedure TForm1.FlowSand(cFile: string);//流沙 varBitmap, BitTemp1, BitTemp2:TBitmap;i,j:integer; beginBitTemp1 := TBitmap.Create;BitTemp2 := TBitMap.Create;Bitmap:=TBitmap.Create;tryLoadImage(BitTemp1, cFile);//載入圖片BitTemp2.Width := self.Width;BitTemp2.Height := self.Height;BitTemp2.Canvas.StretchDraw(self.ClientRect, BitTemp1);BitMap.width := Self.width;BitMap.height := Self.height;i:=BitMap.Height;for j:= 1 to i dobeginBitMap.Canvas.CopyRect(Rect(0,j-1,BitMap.Width,j),BitTemp2.Canvas,Rect(0,i-1,BitMap.Width,i));Self.Canvas.Draw(0,j-1,BitMap);Application.ProcessMessages;if Stop then Exit;end;for i:=BitMap.Height downto 1 dobeginBitMap.Canvas.CopyRect(Rect(0,i-1,BitMap.Width,i),BitTemp2.Canvas,Rect(0,i-1,BitMap.Width,i));Self.Canvas.Draw(0,i-1,BitMap);Application.ProcessMessages;if Stop then Exit;end;finallyBitmap.free; //釋放位圖BitTemp1.free;BitTemp2.Free;end; end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer); beginclose; end;procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState); beginclose; end;end.//窗體文件 object Form1: TForm1Left = 237Top = 206Align = alCustomBorderStyle = bsNoneCaption = 'Form1'ClientHeight = 487ClientWidth = 613Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalsePosition = poScreenCenterOnCreate = FormCreateOnDestroy = FormDestroyOnKeyDown = FormKeyDownOnMouseDown = FormMouseDownOnShow = FormShowPixelsPerInch = 96TextHeight = 13object Timer1: TTimerInterval = 2000OnTimer = Timer1TimerLeft = 15Top = 26end end轉(zhuǎn)載于:https://www.cnblogs.com/boltwolf/archive/2011/06/07/2074443.html
總結(jié)
- 上一篇: 西电开源社区Ubuntu 10.04软件
- 下一篇: 仿UC菜单的实现