-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 41e3936
Showing
70 changed files
with
5,823 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.dcu | ||
*.~* | ||
*.sav | ||
*.jpg | ||
*.bmp | ||
*.ide | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{Written by David R. Faulkner, June 1996} | ||
{P.O. Box 434, Kula HI, 96790} | ||
{Internet: [email protected]} | ||
{This unit implements TBarCode, a component that paints Code 39 barcodes} | ||
|
||
unit Barcode; | ||
|
||
|
||
interface | ||
|
||
uses | ||
Messages, Classes, Controls, StdCtrls, BarCodeR; | ||
|
||
type | ||
TBarCode = class(TLabel) | ||
private | ||
{ Private declarations } | ||
_btType : TBarCodeType; | ||
_rScale : integer; | ||
_rNarrowWidth : single; | ||
_iBarcodeWidth : integer; | ||
FAngle : integer; | ||
FTestoInChiaro : boolean; | ||
procedure CaptionChanged(var Message: TMessage); message CM_TEXTCHANGED; | ||
|
||
protected | ||
{ Protected declarations } | ||
procedure Paint; override; {override paint so can draw barcode} | ||
|
||
public | ||
{ Public declarations } | ||
constructor Create(AOwner: TComponent); override; {so can set default} | ||
|
||
published | ||
{ Published declarations } | ||
property BarcodeWidth : integer read _iBarcodeWidth write _iBarcodeWidth; | ||
property NarrowWidth : single read _rNarrowWidth write _rNarrowWidth; | ||
property Angolo : integer read FAngle write FAngle; | ||
property Caption; | ||
property Alignment; | ||
property BarCodeType : TBarCodeType read _btType write _btType; | ||
property Scale : integer read _rScale write _rScale default 1; | ||
property TestoInChiaro : boolean read FTestoInChiaro write FTestoInChiaro default false; | ||
end; | ||
|
||
procedure Register; | ||
|
||
implementation | ||
|
||
{******************************************************************************} | ||
|
||
procedure Register; | ||
begin {Put TBarCode on Delphi Informant tab of Component Palette} | ||
RegisterComponents('Samples', [TBarCode]); | ||
end; | ||
|
||
procedure TBarCode.Paint; | ||
var iBcWidth : integer; | ||
begin | ||
{TBarCode's canvas is already located at Top,Left on the form, so we send | ||
0,0 to BarCodePaint} | ||
BarCodePaint(BarCodeType,Caption,Canvas,0,0,Width,Height,Angolo,Alignment, | ||
Scale,TestoInChiaro, NarrowWidth, iBcWidth ); | ||
BarcodeWidth := iBcWidth; | ||
end; | ||
|
||
constructor TBarCode.Create(AOwner: TComponent); | ||
begin | ||
inherited Create(AOwner); | ||
ControlStyle := ControlStyle - [csOpaque]; {let windows draw background} | ||
Alignment :=taCenter; {default to centered barcode} | ||
Autosize:=false; {don't let tCustomLabel change size} | ||
Height:=50; {a reasonable height} | ||
Width:=175; {a reasonable width} | ||
BarCodeType:=btCode39; | ||
Scale:=1; | ||
Angolo:=0; | ||
end; | ||
|
||
procedure TBarCode.CaptionChanged(var Message: TMessage); | ||
var | ||
x:integer; | ||
CaptionCopy:string; {will build filtered caption in here} | ||
begin | ||
CaptionCopy:=''; | ||
for x:=1 to length(Caption) do {filter out any unsupported characters} | ||
if (pos(upcase(Caption[x]),cValidCode39Characters)<>0) and | ||
(Caption[x]<>'*') then | ||
CaptionCopy:=CaptionCopy+upcase(Caption[x]); | ||
Caption:=CaptionCopy; | ||
inherited; {tCustomLabel's CMTextChanged will cause repaint} | ||
|
||
end; | ||
|
||
|
||
end. |
Binary file not shown.
Oops, something went wrong.