Scalabium Software

SMReport Autogenerated
Knowledge for your independence'.
Home Delphi and C++Builder tips


#38: How can I add a flat/hot track effect for your components

If you want to add a useful feature to your component (like URL in html or PageControl/TabControl.HotTrack) you must handle the CM_MOUSEENTER and CM_MOUSELEAVE messages:

type
  TyourControl = class(TDescControl)
  private
    { Private declarations }
    FLinkFont: TFont;
    FPassiveFont: TFont;

    procedure CMMouseEnter(var Msg: TMessage); message CM_MOUSEENTER;
    procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
  end;

implementation

procedure TyourControl.CMMouseEnter(var Msg: TMessage);
begin
 //Change color when mouse is over control
 Font.Assign(FLinkFont);
end;

procedure TyourControl.CMMouseLeave(var Msg: TMessage);
begin
 //Change color when mouse leaves control
 Font.Assign(FPassiveFont);
end;

As example, you can view a sources of the TURLLabel and/or THighLightLabel components on our site.


Published: November 4, 1999

See also
 
SMReport
Protected Storage Viewer
Viewer for TNEF-files (winmail.dat)
Metafile Convert
Paradox to Text converter
Paradox ActiveX
Paradox to MS Access converter
Database Information Manager
DBExport tools
Clarion to Text converter
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2021, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport advertising