home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue27 / lcd12 / LCD12.ZIP / Source / Lcd_lab.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-06-22  |  20.1 KB  |  587 lines

  1. unit LCD_Lab;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, Windows, WinProcs, WinTypes, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, Menus, StdCtrls, Buttons, ExtCtrls, Matrix;
  8.  
  9. type
  10.   TDotMatrix  = (mat5x7, mat5x8, mat7x9, mat9x12, Hitachi, Hitachi2);
  11.   TPixelSize  = (pix2x2, pix3x3, pix4x4, pix5x5, pix6x6, pix7x7, pix8x8, pix9x9, pix10x10, pix11x11, pix12x12);
  12.   TPixelShape = (Square, Shaped, Round);
  13.   TMyBorder   = (Raised, Lowered, Single, None);
  14.  
  15.   TLCDLabel = class(TGraphicControl)
  16.   private
  17.     FPixelSize : TPixelSize;        { Size of a LCD pixel (in screen pixels    }
  18.     FPixelShape: TPixelShape;       { Shape of a LCD pixel                     }
  19.     FDotMatrix : TDotMatrix;        { Type of character matrix on the LCD      }
  20.     FPixelSpacing : integer;        { Space between each pixel in the matrix   }
  21.     FCharSpacing : integer;         { Space between the characters on the LCD  }
  22.     FLineSpacing : integer;         { Space between text lines on the display  }
  23.     FBorderSpace : integer;         { Distance from the LCD border             }
  24.     FTextLines : integer;           { Number of text lines on the LCD          }
  25.     FNoOfChars : integer;           { Number of characters on a single line    }
  26.     FBackGround : TColor;           { LCD background color                     }
  27.     FPixOnColor : TColor;           { LCD pixel ON color                       }
  28.     FPixOffColor : TColor;          { LCD pixel OFF color                      }
  29.     FPixHalfColor: TColor;          { Half intensity ON color                  }
  30.     FBorderStyle : TMyBorder;       { Border around the the component          }
  31.     FBorderColor : TColor;          { Color of component border                }
  32.     FWidth : integer;               { Label width in pixels                    }
  33.     FHeight : integer;              { Label height in pixels                   }
  34.     charw, charh, ps : integer;     { Temp. storage of character sizes         }
  35.     pix_x, pix_y : integer;
  36.     charbuf : Array[0..256] of Char;
  37.     procedure SetPixelSize(psize : TPixelSize);
  38.     procedure SetDotMatrix(matrix : TDotMatrix);
  39.     procedure SetPixelShape(pshape : TPixelShape);
  40.     procedure SetPixelSpacing(pspacing : integer);
  41.     procedure SetCharSpacing(cspacing : integer);
  42.     procedure SetLineSpacing(lspacing : integer);
  43.     procedure SetBorderSpace(bspace : integer);
  44.     procedure SetTextLines(tlines : integer);
  45.     procedure SetNoOfChars(nchars : integer);
  46.     procedure CalcSize;
  47.     procedure CalcCharSize;
  48.     procedure SetBkgColor(bcolor : TColor);
  49.     procedure SetPixOnColor(ocolor : TColor);
  50.     procedure SetPixOffColor(ocolor : TColor);
  51.     procedure SetBorderStyle(bstyle : TMyBorder);
  52.     procedure SetBorderColor(bcolor : TColor);
  53.     procedure DrawMatrix(BitMap : TBitMap; xpos, ypos : integer; charindex : integer);
  54.     procedure DrawCharacters(BitMap : TBitMap);
  55.     function  GetCaption : TCaption;
  56.     procedure SetCaption(const Value : TCaption);
  57.     procedure CalcHalfColor;
  58.   protected
  59.  
  60.   published
  61.   { Text setting - make the text on the LCD }
  62.     property Caption: TCaption read GetCaption write SetCaption;
  63.   { LCD character parameters }
  64.     property DotMatrix: TDotMatrix read FDotMatrix write SetDotMatrix default mat5x7;
  65.     property PixelSize: TPixelSize read FPixelSize write SetPixelSize default pix2x2;
  66.     property PixelSpacing: integer read FPixelSpacing write SetPixelSpacing;
  67.     property PixelShape: TPixelShape read FPixelShape write SetPixelShape default Square;
  68.   { LCD display parameters }
  69.     property CharSpacing: integer read FCharSpacing write SetCharSpacing;
  70.     property LineSpacing: integer read FLineSpacing write SetLineSpacing;
  71.     property BorderSpace: integer read FBorderSpace write SetBorderSpace;
  72.     property TextLines : integer read FTextLines write SetTextLines;
  73.     property NoOfChars : integer read FNoOfChars write SetNoOfChars;
  74.   { LCD color parameters }
  75.     property BackGround : TColor read FBackGround write SetBkgColor default clSilver;
  76.     property BorderStyle : TMyBorder read FBorderStyle write SetBorderStyle default Lowered;
  77.     property BorderColor : TColor read FBorderColor write SetBorderColor default clBlack;
  78.     property PixelOn : TColor read FPixOnColor write SetPixOnColor default clBlack;
  79.     property PixelOff : TColor read FPixOffColor write SetPixOffColor default clGray;
  80.   { Events }
  81.     property OnClick;
  82.     property OnDblClick;
  83.     property OnDragDrop;
  84.     property OnDragOver;
  85.     property OnEndDrag;
  86.     property OnMouseDown;
  87.     property OnMouseMove;
  88.     property OnMouseUp;
  89.   public
  90.     constructor Create(AOwner : TComponent); override;
  91.     destructor Destroy; override;
  92.     procedure Paint; override;
  93.   end;
  94.  
  95.   procedure register;
  96.  
  97. implementation
  98.  
  99. // uses
  100. //  WinProcs, SysUtils;
  101.  
  102. { Create component }
  103. constructor TLCDLabel.Create(AOwner: TComponent);
  104. begin
  105.   inherited Create(AOwner);
  106.   FWidth := 0;
  107.   FHeight := 0;
  108.   FCharSpacing := 2;
  109.   FLineSpacing := 2;
  110.   FPixelSpacing := 1;
  111.   FBorderSpace := 5;
  112.   FTextLines := 1;
  113.   FNoOfChars := 8;
  114.   FBorderStyle := Lowered;
  115.   FBorderColor := clBlack;
  116.   FBackGround := clSilver;
  117.   FPixOnColor := clBlack;
  118.   FPixOffColor := $00AAAAAA;
  119.   CalcHalfColor;             { Halftone On color          }
  120.   CalcSize;                  { Get correct sizes at start }
  121. end;
  122.  
  123. { Remove component }
  124. destructor TLCDLabel.Destroy;
  125. begin
  126.   inherited Destroy;
  127. end;
  128.  
  129. {******************************************************************************}
  130. procedure TLCDLabel.DrawMatrix(BitMap : TBitMap; xpos, ypos : integer; charindex : integer);
  131. var
  132.   i, j : integer;
  133.   tx, ty : integer;
  134.   CColor : TColor;
  135. begin
  136.   tx := xpos;
  137.   ty := ypos;
  138.   for i := 1 to pix_y do begin
  139.     for j := 1 to pix_x do begin
  140.       case FDotMatrix of
  141.         mat5x7 : begin
  142.                    if Char5x7[charindex][i][j] = 1 then
  143.                      CColor := FPixOnColor
  144.                    else
  145.                      CColor := FPixOffColor;
  146.                  end;
  147.         mat5x8 : begin
  148.                    if Char5x8[charindex][i][j] = 1 then
  149.                      CColor := FPixOnColor
  150.                    else
  151.                      CColor := FPixOffColor;
  152.                  end;
  153.         Hitachi: begin
  154.                    if CharHitachi[charindex][i][j] = 1 then
  155.                      CColor := FPixOnColor
  156.                    else
  157.                      CColor := FPixOffColor;
  158.                  end;
  159.         Hitachi2:begin  // Use full height for character 194 - 223
  160.                    if (charindex <= 161) then begin  // Normal Hitachi
  161.                      if (i <= 7) then begin
  162.                        if CharHitachi[charindex][i][j] = 1 then
  163.                          CColor := FPixOnColor
  164.                        else
  165.                          CColor := FPixOffColor;
  166.                      end else
  167.                        CColor := FPixOffColor;
  168.                    end else begin  // Extended height
  169.                      if CharHitachiExt[charindex - 162][i][j] = 1 then
  170.                        CColor := FPixOnColor
  171.                      else
  172.                        CColor := FPixOffColor;
  173.                    end;
  174.                  end;
  175.         mat7x9 : begin
  176.                    if Char7x9[charindex][i][j] = 1 then
  177.                      CColor := FPixOnColor
  178.                    else
  179.                      CColor := FPixOffColor;
  180.                  end;
  181.         mat9x12: begin
  182.                    if Char9x12[charindex][i][j] = 1 then
  183.                      CColor := FPixOnColor
  184.                    else
  185.                      CColor := FPixOffColor;
  186.                  end;
  187.       end;
  188.     // Paint pixels in selected shape
  189.       case FPixelShape of
  190.         Square: begin  // Standard square pixels
  191.                   BitMap.Canvas.Pen.Color := CColor;
  192.                   BitMap.Canvas.Brush.Color := CColor;
  193.                   BitMap.Canvas.rectangle(tx, ty, tx + ps, ty + ps);
  194.                 end;
  195.         Shaped: begin  // Pixels with shaped corners
  196.                   if CColor = FPixOnColor then begin
  197.                     BitMap.Canvas.Pen.Color := FPixHalfColor;
  198.                     BitMap.Canvas.Brush.Color := FpixHalfColor;
  199.                     BitMap.Canvas.rectangle(tx, ty, tx + ps, ty + ps);
  200.                     BitMap.Canvas.Pen.Color := CColor;
  201.                     BitMap.Canvas.Brush.Color := CColor;
  202.                     BitMap.Canvas.ellipse(tx, ty, tx + ps, ty + ps);
  203.                   end else begin
  204.                     BitMap.Canvas.Pen.Color := CColor;
  205.                     BitMap.Canvas.Brush.Color := CColor;
  206.                     BitMap.Canvas.rectangle(tx, ty, tx + ps, ty + ps);
  207.                   end;
  208.                 end;
  209.         Round : begin  // Round pixels
  210.                   BitMap.Canvas.Pen.Color := CColor;
  211.                   BitMap.Canvas.Brush.Color := CColor;
  212.                   BitMap.Canvas.ellipse(tx, ty, tx + ps, ty + ps);
  213.                 end;
  214.       end;
  215.       tx := tx + ps + FPixelSpacing;
  216.     end;
  217.     tx := xpos;
  218.     ty := ty + ps + FPixelSpacing;
  219.   end;
  220. end;
  221.  
  222. procedure TLCDLabel.DrawCharacters(BitMap : TBitMap);
  223. var
  224.   row ,col : integer;
  225.   xpos, ypos : integer;
  226.   charindex : integer;
  227.   cc : integer;
  228.   textend : Boolean;
  229. begin
  230.   xpos := FBorderSpace + 1;
  231.   ypos := FBorderSpace + 1;
  232.   cc := 0;
  233.   textend := False;
  234.   for row := 1 to FTextLines do begin      { Line counter             }
  235.     for col := 1 to FNoOfChars do begin    { Character counter        }
  236.       if textend = False then              { Check for string end     }
  237.         if charbuf[cc] = #0 then
  238.           textend := True;
  239.       if textend then
  240.         charindex := 0
  241.       else
  242.         charindex := Ord(charbuf[cc]) - 32;
  243.       DrawMatrix(BitMap, xpos, ypos, charindex);
  244.       xpos := xpos + charw + FCharSpacing;
  245.       Inc(cc);
  246.     end;
  247.     ypos := ypos + charh + FLineSpacing;
  248.     xpos := FBorderSpace + 1;
  249.   end;
  250. end;
  251.  
  252. {******************************************************************************}
  253. { Repaint the component }
  254. procedure TLCDLabel.Paint;
  255. var
  256.   BitMap : TBitMap;
  257.   flag : boolean;
  258. begin
  259.   flag := False;
  260.   if Width <> FWidth then begin
  261.     flag := True;
  262.     FWidth := Width;
  263.   end;
  264.   if Height <> FHeight then begin
  265.     flag := True;
  266.     FHeight := Height;
  267.   end;
  268.   if flag then
  269.     CalcCharSize
  270.   else
  271.     CalcSize;                { Get Width and Height correct }
  272.   with Canvas do begin
  273.     BitMap := TBitMap.Create;
  274.     try                         { Draw image off-screen }
  275.       BitMap.Height := Height;
  276.       BitMap.Width := Width;
  277. // Border drawing
  278.       BitMap.Canvas.Pen.Style   := psSolid;
  279.       BitMap.Canvas.Brush.Style := bsSolid;
  280.       BitMap.Canvas.Brush.Color := FBackGround;
  281.       case FBorderStyle of
  282.         None  : begin
  283.                   BitMap.Canvas.Pen.Color := clBtnFace;
  284.                 end;
  285.         Single: BitMap.Canvas.Pen.Color := FBorderColor;
  286.         Lowered, Raised:
  287.                 BitMap.Canvas.Pen.Color := clBtnHighlight;
  288.       end;
  289.       BitMap.Canvas.Rectangle(0, 0, Width, Height);
  290.       BitMap.Canvas.Pen.Color := clBtnShadow;
  291.       case FBorderStyle of
  292.         Lowered: BitMap.Canvas.PolyLine([Point(Width - 1, 0), Point(0, 0), Point(0, Height - 1)]);
  293.         Raised:  BitMap.Canvas.PolyLine([Point(0, Height - 1), Point(Width-1, Height-1), Point(Width-1, 0)]);
  294.       end;
  295. // Character drawing
  296.       DrawCharacters(BitMap);
  297. // Copy drawn characters to Window bitmap
  298.       BitBlt(Canvas.Handle, 0, 0, Width, Height, BitMap.Canvas.Handle, 0, 0, srcCopy);
  299.     finally
  300.       BitMap.Free;
  301.     end;
  302.   end;
  303. end;
  304.  
  305. { Calculate half color intensity }
  306. procedure TLCDLabel.CalcHalfColor;
  307. var
  308.   red, green, blue, control : byte;
  309. begin
  310.   blue := byte(FPixOnColor) div 2;
  311.   green:= byte(FPixOnColor shr 8) div 2;
  312.   red  := byte(FPixOnColor shr 16) div 2;
  313.   control := byte(FPixOnColor shr 24);
  314.   FPixHalfColor := blue + (green * $100) + (red * $10000) + (control * $1000000);
  315. end;
  316.  
  317. { Calculate no of characters and lines from width and heigth }
  318. procedure TLCDLabel.CalcCharSize;
  319. begin
  320.   ps := Ord(FPixelSize) + 2;
  321.   case FDotMatrix of         { Calculate the space taken by the character matrix }
  322.     mat5x7, Hitachi : begin
  323.                pix_x := 5; pix_y := 7;
  324.                charw := (5 * ps) + (4 * FPixelSpacing);
  325.                charh := (7 * ps) + (6 * FPixelSpacing);
  326.              end;
  327.     Hitachi2:begin
  328.                pix_x := 5; pix_y := 10;
  329.                charw := (5 * ps)  + (4 * FPixelSpacing);
  330.                charh := (10 * ps) + (9 * FPixelSpacing);
  331.              end;
  332.     mat5x8 : begin
  333.                pix_x := 5; pix_y := 8;
  334.                charw := (5 * ps) + (4 * FPixelSpacing);
  335.                charh := (8 * ps) + (7 * FPixelSpacing);
  336.              end;
  337.     mat7x9 : begin
  338.                pix_x := 7; pix_y := 9;
  339.                charw := (7 * ps) + (6 * FPixelSpacing);
  340.                charh := (9 * ps) + (8 * FPixelSpacing);
  341.              end;
  342.     mat9x12: begin
  343.                pix_x := 9; pix_y := 12;
  344.                charw := (9 * ps) + (8 * FPixelSpacing);
  345.                charh := (12 * ps) + (11 * FPixelSpacing);
  346.              end;
  347.   end;
  348.   FNoOfChars := (Width - (2 * FBorderSpace) + FCharSpacing) div (charw + FCharSpacing);
  349.   FTextLines := (Height- (2 * FBorderSpace) + FLineSpacing) div (charh + FLineSpacing);
  350.   if FNoOfChars < 1 then FNoOfChars := 1;
  351.   if FTextLines < 1 then FTextLines := 1;
  352.   Width := (FBorderSpace * 2) +                { Distance to sides (there are two) }
  353.            (FCharSpacing * (FNoOfChars - 1)) + { Spaces between charactes          }
  354.            (charw * FNoOfChars) +              { The characters itself             }
  355.            2;                                  { For the border                    }
  356.   Height:= (FBorderSpace * 2) +                { Distance to top and bottom        }
  357.            (FLineSpacing * (FTextLines - 1)) + { Spacing between lines             }
  358.            (charh * FTextLines) +              { The lines                         }
  359.            2;                                  { For the border                    }
  360.   FWidth := Width;
  361.   FHeight := Height;
  362. end;
  363.  
  364. { Calculations for width and height }
  365. procedure TLCDLabel.CalcSize;
  366. begin
  367.   ps := Ord(FPixelSize) + 2;
  368.   case FDotMatrix of         { Calculate the space taken by the character matrix }
  369.     mat5x7, Hitachi : begin
  370.                pix_x := 5; pix_y := 7;
  371.                charw := (5 * ps) + (4 * FPixelSpacing);
  372.                charh := (7 * ps) + (6 * FPixelSpacing);
  373.              end;
  374.     Hitachi2:begin
  375.                pix_x := 5; pix_y := 10;
  376.                charw := (5 * ps) + (4 * FPixelSpacing);
  377.                charh := (10 * ps) + (9 * FPixelSpacing);
  378.              end;
  379.     mat5x8 : begin
  380.                pix_x := 5; pix_y := 8;
  381.                charw := (5 * ps) + (4 * FPixelSpacing);
  382.                charh := (8 * ps) + (7 * FPixelSpacing);
  383.              end;
  384.     mat7x9 : begin
  385.                pix_x := 7; pix_y := 9;
  386.                charw := (7 * ps) + (6 * FPixelSpacing);
  387.                charh := (9 * ps) + (8 * FPixelSpacing);
  388.              end;
  389.     mat9x12: begin
  390.                pix_x := 9; pix_y := 12;
  391.                charw := (9 * ps) + (8 * FPixelSpacing);
  392.                charh := (12 * ps) + (11 * FPixelSpacing);
  393.              end;
  394.   end;
  395.   Width := (FBorderSpace * 2) +                { Distance to sides (there are two) }
  396.            (FCharSpacing * (FNoOfChars - 1)) + { Spaces between charactes          }
  397.            (charw * FNoOfChars) +              { The characters itself             }
  398.            2;                                  { Border outside character area     }
  399.   Height:= (FBorderSpace * 2) +                { Distance to top and bottom        }
  400.            (FLineSpacing * (FTextLines - 1)) + { Spacing between lines             }
  401.            (charh * FTextLines) +              { The lines                         }
  402.            2;                                  { The Border                        }
  403.   FWidth := Width;
  404.   FHeight := Height;
  405. end;
  406.  
  407. { Get caption string }
  408. function TLCDLabel.GetCaption : TCaption;
  409. var
  410.   Buf: Array[0..256] of Char;
  411. begin
  412.   GetTextBuf(Buf, 256);
  413.   StrCopy(charbuf, Buf);
  414.   Result := StrPas(Buf);
  415. end;
  416.  
  417. { Set caption string }
  418. procedure TLCDLabel.SetCaption(const Value : TCaption);
  419. var
  420.   Buffer: Array[0..255] of Char;
  421. begin
  422.   if GetCaption <> Value then begin
  423.     SetTextBuf(StrPCopy(Buffer, Value));
  424.     StrCopy(charbuf, Buffer);
  425.     Paint;  // Force a direct re-paint of label without any flicker
  426.   end;
  427. end;
  428.  
  429. { Change type of dot matrix }
  430. procedure TLCDLabel.SetDotMatrix(matrix : TDotMatrix);
  431. begin
  432.   if matrix <> FDotMatrix then begin
  433.     FDotMatrix := matrix;
  434.     Invalidate;
  435.   end;
  436. end;
  437.  
  438. { Change border style }
  439. procedure TLCDLabel.SetBorderStyle(bstyle : TMyBorder);
  440. begin
  441.   if bstyle <> FBorderStyle then begin
  442.     FBorderStyle := bstyle;
  443.     Invalidate;
  444.   end;
  445. end;
  446.  
  447. { Change border color }
  448. procedure TLCDLabel.SetBorderColor(bcolor : TColor);
  449. begin
  450.   if bcolor <> FBorderColor then begin
  451.     FBorderColor := bcolor;
  452.     Invalidate;
  453.   end;
  454. end;
  455.  
  456. { Change shape of LCD pixels }
  457. procedure TLCDLabel.SetPixelShape(pshape : TPixelShape);
  458. begin
  459.   if pshape <> FPixelShape then begin
  460.     FPixelShape := pshape;
  461.     Invalidate;
  462.   end;
  463. end;
  464.  
  465. { Change pixel spacing (distance between the pixels in the LCD) }
  466. procedure TLCDLabel.SetPixelSpacing(pspacing : integer);
  467. begin
  468.   if pspacing < 0 then
  469.     MessageDlg('Pixel spacing can''t be less than zero!', mtError, [mbOK], 0)
  470.   else begin
  471.     if pspacing <> FPixelSpacing then begin
  472.       FPixelSpacing := pspacing;
  473.       Invalidate;
  474.     end;
  475.   end;
  476. end;
  477.  
  478. { Change character spacing (Distance between characters in the LCD) }
  479. procedure TLCDLabel.SetCharSpacing(cspacing : integer);
  480. begin
  481.   if cspacing < 0 then
  482.     MessageDlg('Character spacing can''t be less than zero!', mtError, [mbOK], 0)
  483.   else begin
  484.     if cspacing <> FCharSpacing then begin
  485.       FCharSpacing := cspacing;
  486.       Invalidate;
  487.     end;
  488.   end;
  489. end;
  490.  
  491. { Change space between lines in a multi-line LCD }
  492. procedure TLCDLabel.SetLineSpacing(lspacing : integer);
  493. begin
  494.   if lspacing < 0 then
  495.     MessageDlg('Line spacing can''t be less than zero!', mtError, [mbOK], 0)
  496.   else begin
  497.     if lspacing <> FLineSpacing then begin
  498.       FLineSpacing := lspacing;
  499.       Invalidate;
  500.     end;
  501.   end;
  502. end;
  503.  
  504. { Change LCD pixel size }
  505. procedure TLCDLabel.SetPixelSize(psize : TPixelSize);
  506. begin
  507.   if psize <> FPixelSize then begin
  508.     FPixelSize := psize;
  509.     Invalidate;
  510.   end;
  511. end;
  512.  
  513. { Set space between the border and character array }
  514. procedure TLCDLabel.SetBorderSpace(bspace : integer);
  515. begin
  516.   if bspace < 0 then
  517.     MessageDlg('Border spacing can''t be less than zero!', mtError, [mbOK], 0)
  518.   else begin
  519.     if bspace <> FBorderSpace then begin
  520.       FBorderSpace := bspace;
  521.       Invalidate;
  522.     end;
  523.   end;
  524. end;
  525.  
  526. { Set number of text lines on the LCD }
  527. procedure TLCDLabel.SetTextLines(tlines : integer);
  528. begin
  529.   if tlines < 1 then
  530.     MessageDlg('Display needs at least on line!', mtError, [mbOK], 0)
  531.   else begin
  532.     if tlines <> FTextLines then begin
  533.       FTextLines := tlines;
  534.       Invalidate;
  535.     end;
  536.   end;
  537. end;
  538.  
  539. { Set number of characters on one line (all lines are of same length) }
  540. procedure TLCDLabel.SetNoOfChars(nchars : integer);
  541. begin
  542.   if nchars < 1 then
  543.     MessageDlg('Display needs at least one character!', mtError, [mbOK], 0)
  544.   else begin
  545.     if nchars <> FNoOfChars then begin
  546.       FNoOfChars := nchars;
  547.       Invalidate;
  548.     end;
  549.   end;
  550. end;
  551.  
  552. { Set background color }
  553. procedure TLCDLabel.SetBkgColor(bcolor : TColor);
  554. begin
  555.   if bcolor <> FBackGround then begin
  556.     FBackGround := bcolor;
  557.     Invalidate;
  558.   end;
  559. end;
  560.  
  561. { Set pixel ON color }
  562. procedure TLCDLabel.SetPixOnColor(ocolor : TColor);
  563. begin
  564.   if ocolor <> FPixOnColor then begin
  565.     FPixOnColor := ocolor;
  566.     CalcHalfColor;
  567.     Invalidate;
  568.   end;
  569. end;
  570.  
  571. { Set pixel OFF color }
  572. procedure TLCDLabel.SetPixOffColor(ocolor : TColor);
  573. begin
  574.   if ocolor <> FPixOffColor then begin
  575.     FPixOffColor := ocolor;
  576.     Invalidate;
  577.   end;
  578. end;
  579.  
  580. { Component registration }
  581. procedure register;
  582. begin
  583.   RegisterComponents('Samples', [TLCDLabel]);
  584. end;
  585.  
  586. end.
  587.