📄 lcdline.pas
字号:
unit LCDLine;
interface
uses
SysUtils, Classes, Controls, Windows, Graphics, LCD_Char;
type
TFrameStyle = (Relief, None, Lowered, Raised);
TFrameColorStyle = (stWindows, stColor);
TFrameHeight = (Double, Single);
TCellShape = (stSquare, stRound);
type
TLCDLine = class(TGraphicControl)
private
{ Private declarations }
BitMap: TBitMap;
FCellSize: Integer;
FCellSpace: Integer;
FColCount: Integer;
FRowCount: Integer;
FCharCount: Integer;
FGlobalColCount: Integer;
FCharWidth: Integer;
FFrameSize: Integer;
FBoardWidth : Integer;
FBoardHeight: Integer;
FLEDWidth: Integer;
FLEDHeight: Integer;
FFrameColor: TColor;
FBoardColor: TColor;
FCellColorOn: TColor;
FCellColorOff: TColor;
FBWidth : Integer;
FBHeight: Integer;
FOffset: Longint;
FLenText: Integer;
FText: String;
FCharSpace: Boolean;
FCellsOn: array of array of Boolean;
FCountOn: Integer;
FAutoSize: Boolean;
FFrameStyle: TFrameStyle;
FFrameHeight: TFrameHeight;
FFrameColorStyle: TFrameColorStyle;
FCellShape: TCellShape;
procedure SetCellShape(const Value: TCellShape);
procedure SetFrameColorStyle(const Value: TFrameColorStyle);
procedure SetFrameHeight(const Value: TFrameHeight);
procedure SetFrameStyle(const Value: TFrameStyle);
procedure SetLAutoSize(const Value: Boolean);
function GetCellsOn(Row, Col: Integer): Boolean;
procedure SetCellsOn(Row, Col: Integer; const Value: Boolean);
procedure SetCharSpace(const Value: Boolean);
function GetCharCount: Longint;
function GetGlobalColCount: Longint;
procedure SetOffset(const Value: Longint);
procedure SetText(const Value: String);
procedure SetCellColorOff(const Value: TColor);
procedure SetCelColorlOn(const Value: TColor);
procedure SetBoardColor(const Value: TColor);
procedure SetFrameColor(const Value: TColor);
procedure SetFrameSize(const Value: Integer);
procedure SetCellSize(const Value: Integer);
procedure SetCellSpace(const Value: Integer);
procedure DrawCalc();
procedure DrawBorder();
procedure DrawGrid();
procedure DrawSpace();
procedure DrawText();
procedure DrawChar(Row, Col, NChar: Integer);
procedure DrawCell(Row, Col: Integer; ColorCell: TColor);
procedure DrawShadow(StartP, EndP: TPoint; LineColor1, LineColor2: TColor);
procedure OutBorder();
procedure DrawCellsOn();
protected
procedure Paint; override;
public
constructor Create(AOwner: Tcomponent); override;
destructor Destroy; override;
property Offset: Longint read FOffset write SetOffset;
property CharCount: Longint read GetCharCount;
property GlobalColCount: Longint read GetGlobalColCount;
property ColCount: Integer read FColCount;
property RowCount: Integer read FRowCount;
property CellsOn [Row, Col: Integer]: Boolean read GetCellsOn write SetCellsOn;
published
property ShowHint;
property Visible;
property OnClick;
property OnDblClick;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property CellSize: Integer read FCellSize write SetCellSize;
property CellSpace: Integer read FCellSpace write SetCellSpace;
property FrameSize: Integer read FFrameSize write SetFrameSize;
property FrameColor: TColor read FFrameColor write SetFrameColor;
property BoardColor: TColor read FBoardColor write SetBoardColor;
property CellColorOn: TColor read FCellColorOn write SetCelColorlOn;
property CellColorOff: TColor read FCellColorOff write SetCellColorOff;
property Text: String read FText write SetText;
property CharSpace: Boolean read FCharSpace write SetCharSpace default False;
property AutoSize: Boolean read FAutoSize write SetLAutoSize default False;
property FrameStyle: TFrameStyle read FFrameStyle write SetFrameStyle default Relief;
property FrameHeight: TFrameHeight read FFrameHeight write SetFrameHeight default Double;
property FrameColorStyle: TFrameColorStyle read FFrameColorStyle write SetFrameColorStyle default stWindows;
property CellShape: TCellShape read FCellShape write SetCellShape default stSquare;
end;
procedure Register;
implementation
uses
Dialogs;
//*********************************************
procedure Register;
begin
RegisterComponents('Samples', [TLCDLine]);
end;
//********************************************
constructor TLCDLine.Create(AOwner: Tcomponent);
begin
inherited create(AOwner);
ControlStyle := ControlStyle + [csOpaque];
Width := 156;
Height := 76;
FColCount := 5; // 阻耠
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -