⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmledlbl.pas

📁 一套及时通讯的原码
💻 PAS
字号:
{========================================================================}
{=                (c) 1995-98 SwiftSoft Ronald Dittrich                 =}
{========================================================================}
{=                          All Rights Reserved                         =}
{========================================================================}
{=  D 01099 Dresden             = Fax.: +49 (0)351-8037944              =}
{=  Loewenstr.7a                = info@swiftsoft.de                     =}
{========================================================================}
{=  Actual versions on http://www.swiftsoft.de/mmtools.html             =}
{========================================================================}
{=  This code is for reference purposes only and may not be copied or   =}
{=  distributed in any format electronic or otherwise except one copy   =}
{=  for backup purposes.                                                =}
{=                                                                      =}
{=  No Delphi Component Kit or Component individually or in a collection=}
{=  subclassed or otherwise from the code in this unit, or associated   =}
{=  .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed     =}
{=  without express permission from SwiftSoft.                          =}
{=                                                                      =}
{=  For more licence informations please refer to the associated        =}
{=  HelpFile.                                                           =}
{========================================================================}
{=  $Date: 05.09.98 - 23:38:57 $                                        =}
{========================================================================}
Unit MMLEDLbl;

{ these font resources are available: }
{ 'FONT_11X13' }
{ 'FONT_16X20' }

{====- 22-03-99 :  added by Laurent TAUPIN cutmaster@fearlesss.com : -===}
{====- FONT_11X13_BOLD : a small bold font, more readable...         -===}
{====- Create "full cars" font including lowercase & other cars      -===}

{$I COMPILER.INC}

interface

uses
{$IFDEF WIN32}
    Windows,
{$ELSE}
    WinTypes,
    WinProcs,
{$ENDIF}
    SysUtils,
    Messages,
    Classes,
    Graphics,
    Controls,
    Forms,
    Dialogs,
    ExtCtrls,
    Menus,
    MMObj,
    MMUtils,
    MMString;

type
    TMMLEDFontSize =(fs11x13,fs16x20,fs11x13_bold);

    TMMLabelDrawEvent = procedure(Sender: TObject; aBitmap: TBitmap; aRect: TRect) of object;

    {-- TMMLEDLabel ------------------------------------------------------}
    TMMLEDLABEL = class(TMMGraphicControl)
    private
       FRC_CharWidth : integer;         { the width of one digit          }
       FRC_CharHeight: integer;         { added : height of chars         }
       FSize         : TMMLEDFontSize;
       FBevelExtend  : integer;         { the bevel width for one side    }
       FAlignment    : TAlignment;
       FAutoSize     : Boolean;
       FDrawInactive : Boolean;
       FInactiveColor: TColor;
       FLEDColor     : TColor;
       FLEDSpace     : integer;
       FNumChars     : integer;
       FBitmap       : TBitmap;
       FDoubleBitmap : TBitmap;
       FAutoScroll   : Boolean;
       FDoubleBuffer : Boolean;
       FTag2         : integer;
       FTimer        : TTimer;
       FSpeed        : integer;
       FStartStep    : integer;
       FCurStep      : integer;
       FOnBegin,
       FOnStep,
       FOnEnd        : TNotifyEvent;
       FOnDrawBitmap : TMMLabelDrawEvent;

       procedure LoadNewResource;
       procedure AdjustSize(Var W, H: integer);
       procedure AdjustBounds;
       procedure DrawLabel;
       procedure SetAutoSize(aValue: Boolean);
       procedure SetAlignment(aValue: TAlignment);
       procedure SetDrawInactive(aValue: Boolean);
       procedure SetLEDColor(aColor: TColor);
       procedure SetInactiveColor(aColor: TColor);
       procedure SetLEDSpace(aValue: integer);
       procedure SetSize(aValue: TMMLEDFontSize);
       procedure SetNumChars(aValue: integer);
       procedure SetCurStep(aValue: integer);
       procedure SetStartStep(aValue: integer);
       procedure SetSpeed(aValue: integer);
       procedure SetAutoScroll(aValue: Boolean);
       procedure SetDoubleBuffer(Value: Boolean);
       procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
       procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
       {$IFDEF BUILD_ACTIVEX}
       procedure WMSize(var Message: TWMSize); message WM_SIZE;
       {$ENDIF}

    protected
       procedure Paint; override;
       procedure Loaded; override;
       procedure TimerTick(Sender: TObject);
       procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override;
       procedure Changed; override;
    public
       constructor Create (AOwner: TComponent); override;
       destructor  Destroy; override;

       procedure Start;
       procedure Stop;
    published
       { Events }
       property OnClick;
       property OnDblClick;
       property OnMouseDown;
       property OnMouseMove;
       property OnMouseUp;
       property OnDragDrop;
       property OnDragOver;
       property OnEndDrag;
       property OnStartDrag;
       property OnBegin: TNotifyEvent read FOnBegin write FOnBegin;
       property OnStep: TNotifyEvent read FOnStep write FOnStep;
       property OnEnd: TNotifyEvent read FOnEnd write FOnEnd;
       property OnDrawBitmap: TMMLabelDrawEvent read FOnDrawBitmap write FOnDrawBitmap;

       property Align;
       property Caption;
       property Color default clBlack;
       property ParentShowHint;
       property ParentColor;
       property PopupMenu;
       property ShowHint;
       property Visible;
       property Width default 11;
       property Height default 13;
       property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
       property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
       property Enabled;
       property FontSize: TMMLEDFontSize read FSize write SetSize default fs16X20;
       property DrawInactive: Boolean read FDrawInactive write SetDrawInactive default True;
       property InactiveColor: TColor read FInactiveColor write SetInactiveColor default clGreen;
       property LEDColor: TColor read FLEDColor write SetLEDColor default clLime;
       property NumChars: integer read FNumChars write SetNumChars default 12;
       property LEDSpace: integer read FLEDSpace write SetLEDSpace default 1;
       property ScrollSpeed: integer read FSpeed write SetSpeed default 100;
       property StartStep: integer read FStartStep write SetStartStep default 0;
       property CurrentStep: integer read FCurStep write SetCurStep default 0;
       property AutoScroll: Boolean read FAutoScroll write SetAutoScroll default False;
       property DoubleBuffer: Boolean read FDoubleBuffer write SetDoubleBuffer default False;
       property Tag2: integer read FTag2 write FTag2;
       property Bevel;
    end;

implementation

{$IFDEF WIN32}
  {$R MMLABEL.D32}
{$ELSE}
  {$R MMLABEL.D16}
{$ENDIF}

const
     RC_NumChars   = 126;      { number of chars in the resource file     }
     RC_MinChar    = Ord(' ');
     RC_MiddleEnd  = Ord('^');
     RC_MiddleStart= Ord('_');
     RC_MaxChar    = Ord('

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -