?
Solved

Animated buttons

Posted on 2006-05-09
4
Medium Priority
?
215 Views
Last Modified: 2010-04-05
Hello,

my task is to create a front form for an application for a tablet PC.
Nothing very complicated- just a couple of buttons big enough to let user switch them with his finger.

Do you know any nicely animated components (buttons)- something that will make this front form look nice and cool.

Best regards

Jack
0
Comment
Question by:Actia
2 Comments
 
LVL 15

Accepted Solution

by:
mikelittlewood earned 500 total points
ID: 16637790
0
 
LVL 4

Assisted Solution

by:anorganix
anorganix earned 500 total points
ID: 16638087
Hi!
I made a little demo for you...

Get it from:
http://h1.ripway.com/cosmicsoft/EE/ButtonAnimDemo.zip

Also, I will post the source here, in case others can't download...

////////////////////////////// begin main.pas ///////////////////////////////

unit main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TfrmMain = class(TForm)
    shpClose: TShape;
    lblClose: TLabel;
    tmrAction: TTimer;
    procedure lblCloseMouseEnter(Sender: TObject);
    procedure tmrActionTimer(Sender: TObject);
    procedure lblCloseMouseLeave(Sender: TObject);
    procedure lblCloseClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;

implementation

{$R *.dfm}

procedure TfrmMain.lblCloseMouseEnter(Sender: TObject);
begin
  shpClose.Brush.Color:=clSkyBlue;
  lblClose.Font.Color:=clNavy;

  tmrAction.Enabled:=true;
end;

procedure TfrmMain.lblCloseMouseLeave(Sender: TObject);
begin
  shpClose.Brush.Color:=clWhite;
  lblClose.Font.Color:=clBlack;

  tmrAction.Enabled:=false;
  shpClose.Pen.Style:=psSolid;
end;

procedure TfrmMain.tmrActionTimer(Sender: TObject);
var
  S: TPenStyle;
begin
  S:=shpClose.Pen.Style;

  case S of
    psSolid:
    begin
      shpClose.Pen.Style:=psDash;
      Exit;
    end;

    psDash:
    begin
      shpClose.Pen.Style:=psDot;
      Exit;
    end;

    psDot:
    begin
      shpClose.Pen.Style:=psDashDot;
      Exit;
    end;

    psDashDot:
    begin
      shpClose.Pen.Style:=psDashDotDot;
      Exit;
    end;

    psDashDotDot:
    begin
      shpClose.Pen.Style:=psSolid;
      Exit;
    end;
  end;
end;

procedure TfrmMain.lblCloseClick(Sender: TObject);
begin
  Close;
end;

end.

///////////////////////////////////// end main.pas //////////////////////////////////

///////////////////////////////////// begin main.dfm /////////////////////////////////

object frmMain: TfrmMain
  Left = 192
  Top = 107
  BorderIcons = [biSystemMenu, biMinimize]
  BorderStyle = bsSingle
  Caption = 'Animation Demo'
  ClientHeight = 73
  ClientWidth = 177
  Color = clBtnFace
  Font.Charset = ANSI_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  PixelsPerInch = 96
  TextHeight = 13
  object shpClose: TShape
    Left = 16
    Top = 16
    Width = 145
    Height = 41
  end
  object lblClose: TLabel
    Left = 17
    Top = 17
    Width = 144
    Height = 39
    Alignment = taCenter
    AutoSize = False
    Caption = 'Close Program'
    Font.Charset = ANSI_CHARSET
    Font.Color = clBlack
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    Transparent = True
    Layout = tlCenter
    OnClick = lblCloseClick
    OnMouseEnter = lblCloseMouseEnter
    OnMouseLeave = lblCloseMouseLeave
  end
  object tmrAction: TTimer
    Enabled = False
    Interval = 100
    OnTimer = tmrActionTimer
    Left = 18
    Top = 18
  end
end

//////////////////////////////////// end main.dfm //////////////////////////////////////

Hope it helps...
Cheers!

 :: Cosmin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question