<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 3  文章 - 2  trackbacks - 0
    <2007年4月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    293012345

    常用鏈接

    留言簿(1)

    隨筆分類

    隨筆檔案

    相冊(cè)

    收藏夾

    最新隨筆

    搜索

    •  

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    用delphi編寫圖片播放組件(原創(chuàng))-----轉(zhuǎn)載請(qǐng)寫明出處
    { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ::? Author:pengyi??? Email:pengyi.yi@126.com??? ::
    :: ::
    :: Unit : UnitImagePlay ::
    :: ::
    :: Developer Team : Mdcl DevTeam ::
    :: $Id: UnitImagePlay.pas,v 1.13 2006/07/13 08:22:24 Exp $ ::
    :: ::
    :: Created Date : 2005-12-8 ::
    :: Last Modified: $Date: 2006/07/13 08:22:24 $ ::
    :: Last Modifier: $Author:pengyi $ ::
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }

    unit UnitImagePlay;

    interface
    uses Messages, Windows, SysUtils, Classes, CutlineU,
    Controls, Forms, ExtCtrls, Graphics, StdCtrls, Dialogs;
    type
    TXPImage = class;

    TShowPicture = class(TThread)
    private
    Fidx: integer; {當(dāng)時(shí)顯示的數(shù)}
    //I:integer;
    FItem: TXPImage;
    protected
    procedure Execute; override;
    public
    procedure SetPicture;
    constructor Create(Aowner: TXPImage);
    end;

    TXPImage = class(TComponent)
    private
    FActive: Boolean; //當(dāng)前是否擊活
    FInterval: Integer;
    //FTimer :TTimer;
    FImgbmp: TBitmap;
    //FImage: TImage;
    FImage: TCutline;
    FImageList: TImageList;
    FshowPic: TShowPicture;
    procedure SetActive(Value: Boolean); virtual;
    procedure SetInterval(Value: Integer);
    procedure SetImageList(Value: TImageList);
    procedure SetImage(Value: TCutline);
    public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Start;
    // Procedure Pause;
    //Procedure Continue;
    procedure Stop;
    property Active: Boolean read FActive write SetActive;
    property Interval: Integer read FInterval write SetInterval;
    property Imgbmp: TBitmap read FImgbmp write FImgbmp;
    property ImageList: TImageList read FImageList write SetImageList;
    //Property Image:TImage Read FImage Write SetImage;
    property Image: TCutline read FImage write SetImage;

    //Property showPic:TShowPicture Read FshowPic;
    end;

    implementation

    uses
    CommonU, DbugIntf;

    { TXPImage }

    constructor TXPImage.Create(AOwner: TComponent);
    begin
    inherited;
    FInterval := 800;
    FImgbmp := TBitmap.Create;
    //FImage := TCutline.Create(AOwner);
    //FImageList := TImageList.Create(AOwner);
    //FTimer := TTimer.Create(AOwner);
    //FImage := TImage.Create(AOwner);
    end;

    destructor TXPImage.Destroy;
    begin
    if Assigned(FImgbmp) then
    FImgbmp.Free;
    //FTimer.Free;
    //FImage.Free;
    //FImageList.Free;
    inherited;
    end;

    procedure TXPImage.SetActive(Value: Boolean);
    begin
    FActive := Value;
    if (FshowPic <> nil) and Value then
    FshowPic := TShowPicture.Create(Self)
    else
    FshowPic.Terminate;
    end;

    procedure TXPImage.SetImageList(Value: TImageList);
    begin
    FImageList := Value;
    end;

    procedure TXPImage.SetInterval(Value: Integer);
    begin
    FInterval := value;
    end;

    procedure TXPImage.SetImage(Value: TCutline);
    begin
    FImage := Value;
    end;

    procedure TXPImage.Start;
    begin
    FActive := true;
    //創(chuàng)建線程
    FshowPic := TShowPicture.Create(Self);
    //FshowPic.Resume;
    end;

    procedure TXPImage.Stop;
    begin
    //FActive:= false;
    if FshowPic <> nil then
    begin
    FshowPic.Terminate;
    FshowPic := nil;
    end;
    end;

    {procedure TXPImage.Continue;
    begin
    IF FshowPic<> nil then
    begin
    FActive:= true;
    FshowPic.Resume;
    end;
    end;

    procedure TXPImage.Pause;
    begin
    IF FshowPic<> nil then
    FActive:= false;
    end;}

    { TShowPicture }

    constructor TShowPicture.Create(Aowner: TXPImage);
    begin
    inherited Create(false);
    FItem := Aowner;
    Fidx := 0;
    FreeOnTerminate := true;
    end;

    procedure TShowPicture.Execute;
    //var
    // nTickCount: Cardinal;
    begin
    inherited;
    while not Terminated do
    begin
    if FItem.Active then
    begin
    //Application.ProcessMessages;
    synchronize(SetPicture); {注意此處}
    Fidx := Fidx + 1;
    if Fidx >= FItem.FImageList.Count then
    Fidx := 0;
    if terminated then
    exit;
    //Item.;
    Sleep(FItem.FInterval);

    // nTickCount := GetTickCount;
    // while FItem.Active and (GetTickCount - nTickCount < FItem.FInterval) do
    // Application.ProcessMessages;
    end
    else
    begin
    Suspend;
    end;
    end;
    end;

    procedure TShowPicture.SetPicture;
    var
    sMsg: string;
    begin

    //SendMethodEnter(Format('“%s” 播放動(dòng)畫中的設(shè)置圖片', [FItem.Image.Caption]));
    if FItem.Imgbmp <> nil then
    begin
    try
    //SendDebug('開始從 Imagelist 中獲取圖片');
    FItem.FImageList.GetBitmap(Fidx, FItem.Imgbmp);
    //SendDebug('完成從 Imagelist 中獲取圖片');
    //FItem.FImageList.GetBitmap(Fidx,FItem.FImage.Picture.Bitmap);
    //SendDebug('開始從把圖片給 Cutline 圖片');
    FItem.Image.SetImage(FItem.Imgbmp);
    //SendDebug('完成從把圖片給 Cutline 圖片');
    //SendDebug('開始刷新 Cutline');
    //FItem.FImage.Refresh;
    //SendDebug('完成刷新 Cutline');
    application.ProcessMessages;
    except
    on E: Exception do
    begin
    sMsg := Format('錯(cuò)誤位置:[%s] 類:[%s] 名稱:[%s] 錯(cuò)誤類:[%s] 錯(cuò)誤信息:[%s]',
    ['播放動(dòng)畫' ,ClassName, FItem.Image.Caption, E.ClassName, E.Message]);
    SendDebugEx(sMsg, mtError);
    WriteLog(sMsg);
    end;
    end;
    end;
    //SendMethodExit(Format('“%s” 播放動(dòng)畫中的設(shè)置圖片', [FItem.Image.Caption]));
    //SendSeparator;

    end;

    end.

    posted on 2006-09-21 12:45 pengyi 閱讀(755) 評(píng)論(2)  編輯  收藏 所屬分類: Delphi專區(qū)

    FeedBack:
    # re: 用delphi編寫圖片播放組件 2007-04-04 22:28 Ken.xu
    好象缺少了一個(gè)東西TCutline,TCutline是啥東西啊?  回復(fù)  更多評(píng)論
      
    # re: 用delphi編寫圖片播放組件[未登錄](méi) 2007-04-09 17:21 pengyi
    其實(shí)就是一個(gè)image,你用一個(gè)image替換就ok。  回復(fù)  更多評(píng)論
      

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 91在线视频免费91| 中文字幕日本人妻久久久免费| 久久夜色精品国产亚洲| 美女被免费视频网站a| 国产在线观看免费完整版中文版| 亚洲欧美国产国产综合一区| 日韩av无码成人无码免费| 亚洲综合激情五月色一区| 久青草视频在线观看免费| 在线观看亚洲成人| 两性色午夜视频免费播放| 大陆一级毛片免费视频观看| 中文字幕无码精品亚洲资源网| 中文字幕在线视频免费观看| 亚洲AV无码一区二区乱子伦| 国产成人精品日本亚洲语音| 免费又黄又硬又爽大片| 免费激情网站国产高清第一页| 97在线观免费视频观看| 亚洲免费综合色在线视频| 国产又粗又猛又爽又黄的免费视频| 免费观看又污又黄在线观看| 国产亚洲精品成人AA片新蒲金| 十八禁无码免费网站| 涩涩色中文综合亚洲| 亚洲精品第一国产综合精品99| 最新国产乱人伦偷精品免费网站 | 57pao国产成视频免费播放 | 大学生高清一级毛片免费| 精品国产日韩亚洲一区91| 中文字幕专区在线亚洲| 91高清免费国产自产| 亚洲精品国产美女久久久| 人人爽人人爽人人片A免费| 亚洲熟妇无码乱子AV电影| 精品国产无限资源免费观看| 亚洲美女视频网址| 99久久免费观看| 亚洲高清国产拍精品熟女| 成人永久福利免费观看| 亚洲熟女乱色一区二区三区|