delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
500 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (1)


A Nice Flat Coloured button used as a TButton replacementComponent available for this articleFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi all versions
Category:
GUI
Skill Level:
Scoring:
Last Update:
04/11/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet component flat-button button tpanel highlight
Times Scored:
5
Visits:
2965
Uploader: Stewart Moss
Company: New Heights Software Developme
Reference: http://www.new-heights.co.za/delphi/components/
Component Download: http://www.new-heights.co.za/delphi/components/Smoss Flat Button 1.zip
 
Question/Problem/Abstract:
Nice Flat Button made from a TPanel with Colour Highlights and Click event (Can customize all the colours)
Answer:




{-----------------------------------------------------------------------------
Unit Name: unitSMOSSFlatButton

COMPONENT
---------

Documentation Date: 20/02/02 00:05:24
Version: 1.1

Compiler directives:

Purpose:
  Is a nice Flat Coloured button used as a TButton replacement.

Description:

  Nice Flat Button made of a TPanel with Colour Highlights and Click features
  (Can customize all the colours)

Dependancies:
  None

          Copyright 2001 by Stewart Moss
          All rights reserved.
-----------------------------------------------------------------------------}

unit unitSMOSSFlatButton;

interface

uses
  
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, Graphics;

type
  
TSMOSSFlatButton = class(TPanel)
  private
    
{ Private declarations }
    
FHilite : Boolean;
    FHiLiteColor,
    SaveColor : TColor;

    FOnClick: TNotifyEvent;

    procedure MouseEnter(var Message: TMessage); message CM_MOUSEENTER;
    procedure MouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
    procedure ButtonDown(var message : TMessage); message  WM_LBUTTONDOWN;
    procedure ButtonUp(var message : TMessage); message  WM_LBUTTONUP;

    property OnClick : TNotifyEvent read FonClick write FOnclick;
  protected
    
{ Protected declarations }

  
public
    
{ Public declarations }
    
constructor create(aowner : TComponent); override;
  published
    
{ Published declarations }
    
property hiLite : boolean read FHilite write FHilite default true;
    property HiliteColor : TColor read FHiliteColor write FHiliteColor default clred;
  end;

procedure Register;

implementation

procedure Register
;
begin
  
RegisterComponents('Stewart Moss', [TSMOSSFlatButton]);
end;

{ TSMOSSFlatButton }

procedure TSMOSSFlatButton.ButtonDown(var message: TMessage);
begin
inherited
;
BevelInner := bvLowered;
end;

procedure TSMOSSFlatButton.ButtonUp(var message: TMessage);
begin
inherited
;
BevelInner := bvNone;
end;

procedure TSMOSSFlatButton.MouseEnter(var Message: TMessage);
begin
  inherited
;
  if FHilite then
  begin
    
SaveColor := Font.Color;
    Font.Color := FHiliteColor;
  end;
end;

procedure TSMOSSFlatButton.MouseLeave(var Message: TMessage);
begin
  inherited
;
  if FHilite then
  begin
    
Font.Color := SaveColor;
  end;
end;

constructor TSMOSSFlatButton.create(aowner: TComponent);
begin
  inherited
;

  FHilite := true;
  FHiliteColor := clred;
  Height := 25;
  width := 75;
end;

end.







Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Nice one !!
    Nagendra Peruru (Feb 19 2005 10:26AM)

Very Nice One. But My Doubt is Will it Work for a long time. What i mean to say is, is it Full Version or Demo ? Plz Reply me !
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
L. Rosenstein
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)