Форум · Полнота восстановления · Каталог вариантов

[SHARE] AutoUpdater v4.0.4.2 for private servers (17 Jule 2007) — Breaker — #85843

Сообщение в форуме

Снимок 2008-04-09 20:56 UTC

Имя в снимке: Breaker · Источник Wayback

Hmmmm Delphi? its good =)


Question one to Autor: Your program can update self? 

Question two to Autor: Program can use ftp server for update?


I think if use this on buttons:

  TImageButton = class(TGraphicControl)

  private

    MOver: TBitmap;

    MDown: TBitmap;

    MUp: TBitmap;

    Bmp: TBitmap;

    ActualBmp: TBitmap;

    BmpDAble: TBitmap;

    BtnClick: TNotifyEvent;

    OnMDown: TMouseEvent;

    OnMUp: TMouseEvent;

    OnMEnter: TNotifyEvent;

    OnMLeave: TNotifyEvent;

    procedure SetMOver(Value: TBitmap);

    procedure SetMDown(Value: TBitmap);

    procedure SetMUp(Value: TBitmap);

    procedure SetBmp(Value: TBitmap);

    procedure SetBmpDAble(Value: TBitmap);

  protected

    procedure Paint; override;

    procedure MouseDown(Button: TMouseButton; Shift: TShiftState;

      X, Y: Integer); override;

    procedure MouseUp(Button: TMouseButton; Shift: TShiftState;

      X, Y: Integer); override;

    procedure MouseEnter(var Message: TMessage); message CM_MOUSEENTER;

    procedure MouseLeave(var Message: TMessage); message CM_MOUSELEAVE;

    procedure Click; override;

  public

    constructor Create(AOwner: TComponent); override;

  published

    property BitmapOver: TBitmap read MOver write SetMOver;

    property BitmapDown: TBitmap read MDown write SetMDown;

    property BitmapUp: TBitmap read MUp write SetMUp;

    property BitmapDisabled: TBitmap read BmpDAble write SetBmpDAble;

    property Bitmap: TBitmap read Bmp write SetBmp;

    property OnClick: TNotifyEvent read BtnClick write BtnClick;

    property OnMouseDown: TMouseEvent read OnMDown write OnMDown;

    property OnMouseUp: TMouseEvent read OnMUp write OnMUp;

    property OnMouseEnter: TNotifyEvent read OnMEnter write OnMEnter;

    property OnMouseLeave: TNotifyEvent read OnMLeave write OnMLeave;

    property Enabled;

    property ShowHint;

    property ParentShowHint;

  end;


implementation


constructor TImageButton.Create(AOwner: TComponent);

begin

  inherited Create(AOwner);

  MOver := TBitmap.Create;

  MDown := TBitmap.Create;

  MUp := TBitmap.Create;

  Bmp := TBitmap.Create;

  BmpDAble := TBitmap.Create;

  ActualBmp := TBitmap.Create;

  Width := 50;

  Height := 50;

  Canvas.Brush.Color := clBtnFace;

  ShowHint := true;

end;


procedure TImageButton.Paint;

begin

  inherited Paint;

  if ActualBmp.Width = 0 then ActualBmp.Assign(Bmp);

  Canvas.FillRect(Rect(0,0,Width,Height));

  if Enabled or (BmpDAble.Width = 0) then Canvas.Draw(0,0,ActualBmp)

  else begin

    Width := BmpDAble.Width;

    Height := BmpDAble.Height;

    Canvas.Draw(0,0,BmpDAble);

  end;

end;


procedure TImageButton.Click;

begin

  inherited Click;

  Paint;

  if Enabled then if Assigned(BtnClick) then BtnClick(Self);

end;


procedure TImageButton.SetMOver(Value: TBitmap);

begin

  MOver.Assign(Value);

  Paint;

end;


procedure TImageButton.SetMDown(Value: TBitmap);

begin

  MDown.Assign(Value);

  Paint;

end;


procedure TImageButton.SetMUp(Value: TBitmap);

begin

  MUp.Assign(Value);

  Paint;

end;


procedure TImageButton.SetBmp(Value: TBitmap);

begin

  Bmp.Assign(Value);

  ActualBmp.Assign(Value);

  Width := Bmp.Width;

  Height := Bmp.Height;

  Paint;

end;


procedure TImageButton.SetBmpDAble(Value: TBitmap);

begin

  BmpDAble.Assign(Value);

  paint;

end;


procedure TImageButton.MouseDown(Button: TMouseButton; Shift: TShiftState;

  X, Y: Integer);

begin

  inherited MouseDown(Button, Shift, X, Y);

  if (Button = mbLeft) and Enabled then begin

     if Assigned (OnMDown) then OnMDown(Self, Button, Shift, X, Y);

     if MDown.Width > 0 then begin

        ActualBmp.Assign(MDown);

        Width := MDown.Width;

        Height := MDown.Height;

        Paint;

     end;

  end;

end;


procedure TImageButton.MouseUp(Button: TMouseButton; Shift: TShiftState;

  X, Y: Integer);

var MouseOverButton: Boolean;

    P: TPoint;

begin

  inherited MouseUp(Button, Shift, X, Y);

  if (Button = mbLeft) and Enabled then begin

     if Assigned (OnMUp) then OnMUp(Self, Button, Shift, X, Y);

     if MUp.Width > 0 then begin

        GetCursorPos(P);

        MouseOverButton := (FindDragTarget(P, True) = Self);

        if MouseOverButton then begin

           Width := MUp.Width;

           Height := MUp.Height;

           Canvas.FillRect(Rect(0,0,Width,Height));

           Canvas.Draw(0,0,MUp);

        end else begin

           Width := bmp.Width;

           Height := Bmp.Height;

           Canvas.FillRect(Rect(0,0,Width,Height));

           Canvas.Draw(0,0,Bmp);

        end;

     end else begin

        if MouseOverButton = false then begin

           Width := MOver.Width;

           Height := MOver.Height;

           Canvas.FillRect(Rect(0,0,Width,Height));

           Canvas.Draw(0,0,MOver);

        end else begin

           Width := bmp.Width;

           Height := Bmp.Height;

           Canvas.FillRect(Rect(0,0,Width,Height));

           Canvas.Draw(0,0,Bmp);

        end;

     end;

  end;

end;


procedure TImageButton.MouseEnter(var Message: TMessage);

begin

  if Enabled then begin

     if MOver.Width > 0 then begin

        ActualBmp.Assign(MOver);

        Width := MOver.Width;

        Height := MOver.Height;

        Paint;

     end;

  end;

end;


procedure TImageButton.MouseLeave(var Message: TMessage);

begin

  if Enabled then begin

     if Bmp.Width > 0 then begin

        ActualBmp.Assign(Bmp);

        Width := Bmp.Width;

        Height := Bmp.Height;

        Paint;

     end;

  end;

end;


on results look is cool...my example:

(This auto launcher i make for my Ultima Online project): program here.... for look http://uo.utech.ru/uo.exe


Thanks...