      

      

           
Delphi.            
-;;      .     
        
    . Delphi       
  .    ,  
 " ".   ,    
 ,      ,    .    
 ,     .     
        ,   
   .    ,   
         IDE Delphi.    
   ,      
Object Pascal,    ,      . 
      Delphi   130 ,  
    .      
    ,    ,    
 ,   ,   ,    
   ,  -     
,     .   
  ,       . 
      ,   . 
    1.	  . 
    2.	  . 
    3.	  . 
    4.	    . 
    5.	     . 

     16 

         

        . 

       

              
        Delphi. 
      
     ,   ,   . 

      

       ,    . 

358

         Delphi (Visual Component 
Library,  VCL)   ,     
  .   -  ,  
   ,   ,     
  .       VCL,  
   Borland. 

       

         (  )  
    ,      
 . Delphi      
,    ( ,      
      ). 
              .   
   ,       
 .        , 
     . 

       

    Delphi     ,    
  .  . 16.1      
,       . 

     16.1.    Delphi 

      VCL 

     
    TObject	He  .       
Delphi.         ,  
      . 
  ^^^^?^^.> IDjE 
    TComponent	     . 
        IDE                      
    TGraphicControl 
      Paint ()         . 
   ,  ^^^^^^^	___             __      
    TWinControl 
        "" .  _  
  ___	        _____________    _______   ____~~_____       ___ 
    TCustomControl        TGraphicControl  TWinControl. 
       Paint ().  
^     	~", 

     TComponent   : Owner, Name, Tag, 
ComponentState  Components.  Components   , 
   ,    . 
    TComponent     
    .  TComponent  
, -^^  (..    )  
DFM-,     .	~~ 
     TControl    . 16.1,     . 
     TGraphicControl  TWinControl     
TControl,       , 
  -    .   
  : Left, Top, Width, Height, Align, Visible, 
Enabled, Cursor  On-Click.       
  VCL     (Object Browser). 
     TGraphicControl    Paint (),   
 Canvas.      ,   
   ,    ,   
 . 
     TWinControl  ,     
 .   : Handle, TabOrder, TabStop, CtlSD, 
OnEnter  .         VCL  
  . 

     16.   359 

     TCustomControl     TGraphicControl 
      TWinControl.  ,  
        . 

       

     Delphi  ,     
,       ,     
  ,      .    
    :    
 ,      .  
    , ,   TEdit  
TCustomEdit.    TEdit    TCustomEdit,  
 TEdit    ,    .  
    ,      
.    ,    
   ,     ,    
,     .      
  VCL. 

       

          ,    
     (, , 
,   ..)     ,  
    (Component Templates'),   
  .       
        
Component^Create Component Template   Delphi.    
      (  )    
   .      
  DELPHI32. ,     De],phi3\BIN. 
         , Delphi   
       ,   
,        . 

       

       ,   ,  
    .    
       (Component 
Expert),   . 16.1.    , 
    Delphi  File^New,     
    (Object Repository),     
Component.           
 Component^New Component. 

    . 16.1.   Delphi 

           ,  
   . -,   ,    
  . -,      
 . (     Delphi,  
      .) -,  ,  
         
.          
   . -,    ,  
   . , ,      
 ,       ,   
  . 

    360  IV.   

            , 
       -   .  
         ,  
 ?          
,   ,      , 
     . 
       TEverything,    
  TCustomControl.      Using Delphi 
  (Component Library).      
 ,   . 16.1,   ,   
 16.1.        . 

     16.1. \UDELPHI3\CHP16\LIST16-1.     

TEverything	j unit  EvryThng; 
    interface 
    uses 
    Windows,   Messages,    SysUtils,    Classes,    Graphics,    Controls,    
Forms,    Dialogs,
    type 
    TEverything = class(TCustomControl) private 
    {  . } protected 
    {  . } public 
    {  . } published 
    {  . } end; 
    procedure Register; implementation 
    procedure Register; begin 
    RegisterComponents('UD3', [TEverything]); end; 
    end. 


      

            
.           
             
 .   ,    
    private. 
           private   
   F. ,  Color     
     FColor. 
    I  1 

      

           ,  
: Simple, Enumerated, Set, Ob j ect  Array.    
-         
 .        
 ,          
,         
Object Inspector. 
            , 
      public  published. 

     16.  	361 


       

      (Simple)  ,     
.           
   .  Delphi   
 {^ (integer)   (String) .  
,  Left, Top, Width  Height,   

    Integer, a Caption, Text  Name    . 

      16.2        
 (      )      
published,       .   
   !111^^1(11". 

     16.2. \UDELPHi3\CHPl6\LiSTl6-2.  TEverything  
   

    TEverything =  class(TCustomControl] private 
    {     .   } 
    FNumber     ^/'integer; 
    FChar	:! char;^> 
    FString     :\ string;"*  , protected 
    {   , , public 
    {     .   } published 
    {      
    property NumberProp:^integer  read FNumber write  FNumber; 
    property  CharProp:   char   read  FChar  write   FChar; 
    property  StringProp:   string   read  FString  write   FString; end; 

     NumberProp, CharProp  StringProp     
       0, #0   
 .        , 
  ,      "" .  
   ,   - null _#0,     
 .         
   .        
     .         
   ,         
,   . 16.2. 

    . 16.2.  TEverything       


       

      (Enumerated)    
,  (Boolean)    ,  
.         
  .       
 ,    ,   
,           
   . Delphi      
,  Color, -derStyle, FormStyle  Cursor. 
         Delphi   
   ,  ,  
    .  . 16.2   
          . 

    362  IV.   


     16.2.    Delphi 

      

    BorderStyle 

     
    Color	clBlack, clYellow, clMenu, clWindow  clBtnFace.   
  __________________ GRAPHICS.PAS__________________________________ 
    Cursor	crDef ault, crNone, crArrow, crNo, crAppStart  crHelp.  
    CONROLS.PAS 
    bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow  bsSizeToolWin 

    FormStyle 
    fsNormal, fsMDIChild, f sMDIForm, fsStayOnTop 

            
TEverything,       .  
      TEnumProp,    
 .    : 

    TEnumProp =   (epZero,   epOne,   epTwo,   epThree,   epFour,   epFive); 

           TEverything,  
  - ,    (Boolean),    
,  .   ColorProp, BooleanProp  EnumProp 
.  TEverything   ,    
16.3.        . 

     16.3. \UDELPHl3\CHP16\LIST16-3.   TEverything  
   

    TEnumProp =   (epZero,   ,   epTwo,   epThree,   epFour,   epFive); 
    TEverything  =  class(TCustomControl) private 
    (      .    } 
    FColor        :   TColor; 
    FBoolean   :   boolean; 
    FEnumProp:   TEnumProp; protected 
    {      .    } public 
    {     .    } published 
    {     .   } 
    property  ColorProp:   TColor   read JTColor  write   FColor; 
    property BooleanProp:   boolean  read  FBoolean write   FBoolean; 
    property EnumProp:   TEnumProp  read  FEnumProp write  FEnumProp; end; 

       TEverything        
,         ,   . 
16.3.    ,       
       ,     
  ,   . 

    . 16.3.  TEverything      


     16.   363 


       "" 

      "" (Set)     Pascal. 
            
    (+),     . 
 "  ",  , 
          
.            
         True 
 False,  ,      . Delphi 
   Set   ,  Borderlcons  Options.  
        
 . 
        ,    
.     ,    , 
  ,   . 
    TEnumProp  =   (epZero,   epOne,   epTwo,   epThree,   epFour,   epFive) ; 
TSetProp =  set  of TEnumProp; 
       TEverything      
  Set   SetProp.  TEverything   
 ,    16.4. 

     16.4. \UDELPHi3\CHPl6\LiSTi6-4.  TEverything  
  "' 

    TEnumProp  =   (epZero,   epOne,   epTwo,   epThree",   epFour,   epFivej ;" 
    TSetProp = set  of TEnumProp; 
    TEverything  =  class(TCustomControl) private 
    {     .   } 
    FSetProp   :   TSetProp; protected 
    {    .   } public 
    {     .   } 
    constructor  Create(AOwner:   TComponent);   override; 
    destructor   Free; published 
    {     .   } 
    property SetProp:   TSetProp read  FSetProp write  FSetProp; end; 

       TEverything     ,   
      ,   . 16.4. 
      (published)   ""  32 
.         
,    ,    Error (38) : Size of 
published set 'property name' is >4 bytes.       
  32 ,  ,     
 (runtime-only property). 
    I  I 

    . 16.4.  TEverything     "" 


    364  IV.   


       "" 

      " " (Ob j ect)     , 
_    -_ .  
        (+)    
     (...),     
.         Delphi 
   ,     
 .      _  
       .  
. ,          
   TPersistent. Delphi      
,  Font, Hor-zScrollBarVertScrollBar. 
           TEverything,  
  ,      TPersistent, 
  ,   TPersistent.     
    TPersistent,     16.5. 

     16.5. \UDELPHi3\CHP16\LlST16-5.   TObjectProp 

    TObjectProp =  class(TPersistent) private 
    FMylntl   :   integer; 
    FMyInt2   :   integer; 
    FMylntS   :   integer; piblic 
    property  :   integer   read  FMyInt3  write   FMylntS; published 
    property  MyPropl:   integer   read  FMylntl  write   FMylntl; 
    property MyProp2:   integer  read  FMyInt2  write  FMyInt2; end; 

     TObjectProp    (   published) 
 ,       ,  
  (   public)  , 
       .   
TObjectProp    ,   ,   
   ,       
,      .   
  TObjectProp     
oacca~TEverything     TObjectProp  ,  
   . ,   ,  
   Create,   TEverything   
  ,     . 

    constructor  TEverything.Create(AOwner:   TComponent); begin 
    inherited Create(AOwner); 
    FObjectProp   := TObjectProp.Create; end; 

        TObjectProp    Create,  
        
TEverything.    ,     
,    Destroy.   
         
Destroy,      TEverything    
 . 

    Destructor  TEverything.Destroy; begin 
    FObjectProp.Free; 
    inherited Destroy; end; 

      16.6      TEverything 
        . 

     16.6. \UDELPHi3\CHPl6\LiSTl6-6.    "" 

    class;(TPersistentj 
    TObjectProp =  class(TPe: private 
    FMylntl   :   integer; FMyInt2   :   integer; 


     16.   365 


    FMyInt3 : integer/public 
    property : integer read FMylntS write FMyInt3; ..published 
    property MyPropl: integer read FMylntl write FMylntl; 
    property MyProp2: integer read FMyInt2 write FMyInt2; end; 
    TEverything = class(TCustomControl) private 
    {  . } 
    FObjectProp: TObjectProp; protected 
    {  . } public 
    {  . } 
    constructor Create(AOwner: TComponent); override; destructor Destroy; override; 
    published_ 
    {    .   } 
    property ObjectProp:   TObjectProp  read FObjectProp write  FObjectProp; end; 

        TEverything     , 
        ,   . 16.5.  
, ,   ,    ObjectProp  
   (MyPropl  2),     
.  ,   5     
   ObjectProg,    TObj ectProg  
 . 

    . 16.5.  TEverything    "" 


       "" 

      "" (Array)   ,   
  ,        Object 
Pascal.       ,   
 Object Pascal.        Object Pascal  
  . 
        Object Pascal      
,            . 
         Object Pascal    , 
    ""     ,  
  ,    .      
        .	 
              
 (...),     . Delphi 
     ,  Lines, Items  Sections. 
         
 .      ".* 
    ,"    ,,   
    (runtime)      
  .    TArrayProp,    
    ,      . 

    TArrayProp = array [1...5] of string[7]; 


    366  IV.   

       _?;^|??^^<?2?  
TArrayProp.       
 Create  TEverything  : one, two, three, 
four  five. , ,   ArrayPropInt,    
     .  ArrayPropInt  
     ??_ 
jwemod_dpcm^n?jHjBOjBrjaii]aeT^jrjoKOBoe   
.^^. (  "" '^  
"  Get  Set"'.)    ArrayPropStr,  
       .  ArrayPropStr 
       FAr-rayProp   
        ,   . 

    property ArrayPropInt[Index:   integer]:   string  read GetArrayPropInt; 
property ArrayPropStr[Index:   string]:   integer read GetArrayPropStr; 

      16.7     TEverything  
  . ,   ArrayPropInt  ArrayPropStr 
   (public)  .     
    Create,    
 FArrayProp.   GetArrayPropInt  GetArrayPropStr   
 ,   ,    ,     
,   . 

    ;  16.7. \UDELPHl3\CHP16\LlST16-7.  TEverything  
  "" 

    unit EvryThng; 
    interface 
    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; 
    type 
    TArrayProp = array [1..5] of string[7]; 
    TEverything = class(TCustomControl) private 
    {  . } 
    FArrayProp : TArrayProp; 
    function GetArrayPropInt(plndex: integer): string; 
    function GetArrayPropStr(plndex: string): integer; protected 
    {  . } public 
    {  . } 
    constructor Create(AOwner: TComponent); override; 
    property ArrayPropInt[Index: integer]: string read GetArrayPropInt; 
    property ArrayPropStr[Index: string]: integer read GetArrayPropStr; published 
    {  . } end; 
    procedure Register; 
    implementation 
    constructor TEverything.Create (AOwner: TComponent); begin 
    //     FArrayProp. 
    FArrayProp[1] := 'one'; 
    FArrayProp[2] := 'two'; 
    FArrayProp[3] := 'three'; 
    FArrayProp[4] := 'four'; 
    FArrayProp[5] := 'five'; end; 
    function TEverything.GetArrayPropInt(plndex: integer): string; begin 
    result := 'unknown'; 


     16.  	367 


    //   plndex    FArrayProp, //  
   , if plndex in [1..5] then 
    result := FArrayProp[plndex]; end; 
    function TEverything.GetArrayPropStr(plndex: string): integer; var 
    x : integer; begin 
    result := -1; 
    //     FArrayProp //     
 plndex. for x := 1 to 5 do 
    //   Uppercase,  
    //     . 
    if Uppercase(FArrayProp[x]) = Uppercase(plndex) then 
    begin 
    result := x; //    FOR. exit; end; end; 
    procedure Register; begin 
    RegisterComponents('UD3', [TEverything]); end; 
    end. 


      

        ,     
         
  .      _ CBoflcre.Pelphi. 
    	Default 
    	NoDefault 
    	Default    
    	Stored 
    	Index 
    	Dispid 


     Default 

       ,     . 
  integer   ,  string -  , 
 char  ,  #0,   set     
..  Delphi       (  
DFM),           
(Default).    , Delphi   ,   
   , : 
    property NumberProp:   integer  read  FNumber write  FNumber  default   5; 
property EnumProp:   TEnumProp  read  FEnumProp write  FEnumProp default  
epOne; property SetProp:   TSetProp  read  FSetProp write  FSetProp default   [epOne]; 
       NumberProp  5, Delphi    
 NumberProp. 

     
     Default        
    .     ,  
,   ,     DFM-. 
           Default, Delphi  
  . 

    368	 IV.   


     NoDefault 

     NoDefault    Delphi  ,   
    ,   .  
    ,     
. .       
NoDefault  DelpriT56-    ,     
     ,  

    property NumberProp NoDefault; 

       NumberProp       
 ,       . 

     Default    "" 

     Default      /.  
    Delphi  ,      
      .    
 ArrayPropInt  TEverything   Default,   
  

    property ArrayPropInt[Index:   integer]:   string  read GetArrayPropInt;   Default; 

         Everything  TEverything,   
    Everything  :	J 

    Caption   := Everything[3]; 

          "three".   
         . 

     Stored 

     Stored   ,   Delphi,   
 .   Stored     true, false 
 ,    .   Delphi 
    , : 
    property NumberPropl:	integer  read  FNuml	write  FNuml	stored true; 
property NumberProp2:	integer  read  FNum2	write  FNum2	stored  false/property 
NumberProp3:	integer   read  FNum3	write   FNum3	stored  Fund; 
         NumberPropl  , 
  NumberProp2  ,    NumberPropS  
  ,   Fund   true. 

     Index 

     Index       .  
 ,   "  Get  Set". 

     Dispid 

     Dispid   ,   - 
  Dispatch ID.     20, " OLE". 

         

       ,     
^2}_ .      
  1^2^?113?_?,     
. Delphi       
       Read  Write.   
           
        . 
      ,        
,       Read    Write . 

        (private)  

              
  .   16.2      
,   : 
    property NumberProp:   integer  read  FNumber write  FNumber; property 
CharProp:   char  read  FChar write  FChar; property StringProp:   string  
read FString write  FString; 


     16.  	369 

             
  TEverything       (private) 
.     ?  
^.  ^.     
          
    .       
 . 

      Get  Set 

          ,   
   .      
,         "Get".   
       '     
. ?_         
   "Set".        , 
    .        
        .   
  ,       
 : property 

    BooleanProp: Boolean read GetBooleanProp write SetBooleanProp; 

     Read    . 

    function TEverything.GetBooleanProp: boolean; 
    begin   . 
    result := false/if (Estate = 0) then result := true; 
    end; 
      Write    . 
    procedure  TEverything.SetBooleanProp(var pBool: boolean) ; begin 
    if pBool  then Estate:=  0; else 
    Estate:=  1; end; 

        BooleanProp    
  ,     Boolean.    ,  
     FBooleanProp,   BooleanProp 
    Estate. 
     ^^  ,    Read   
.          Index. 
             
  .      Read  Write  
,          .  
,"     ,    
    .       
 ,     ,   
   :  (  )  ',  
..        , 
 ,   16.7. 
    .  Index   Read  , 
  ,     index   
. , ,  . 

    property IntPropl:   integer  index  1   read GetlntProp write  
SetlntProp; property IntProp2:   integer  index  2  read GetlntProp write  SetlntProp; 

       ,          
.       ,     
,    , j;     
  .         
Index.       , ~ 
,     .    
GetlntProp  SetlntProp   . 

    function TEverything.GetlntProp(plndex:   integer):   integer; begin 
    case plndex  of 
    1:   result   := FlntPropl; 2:   result   :=  FIntProp2; end; 


    370  IV.   

    end; 
    procedure TEverything.SetlntProp(plndex: integer; pValue: integer); begin 
    case plndex of 
    1: FlntPropl := pValue;     * 2: FIntProp2 := pValue; end; end; 


      

      ,      
.      Create,     
  Loaded.	*          " 

      Create 

      Create   
       
.       Default,  
   Create       
  .     "   
"'"'       
 . ,      
 Create,      Create  
 -  ,   .    
-   -    
 .	~ " 

      Loaded 

      Loaded     
   ,      .   
  Loaded    , 
,        DFM-.  
      .	" " 
    1.    , ..   . 
    2.         , 
    Create. 
    3.	     . 
    4.	  Loaded. 
    5.	  . 

    	/                      \ 

       Loaded     
Loaded ,  ,     
 . 
           
 Loaded  TEverything    Color  
 clRed,    IntegerProp    5,  
    , ..  Color 
  clGreen.       
Create,   ,   DFM-   IntegerProp,  
  .      16.8,   
     ."" 

     16.8. \UDELPHi3\CHPl6\LiSTl6-8.  TEverything  
  Loaded       ! 

    unit Evryfhng; 
    interface 
    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; 


     16.  	371 


    type 
    TEverything = class(TCustomControl) private 
    {  . } 
    FInteger  : integer; protected	* 
    {  . } 
    procedure Loaded; override; public 
    (  . } published 
    {  . } 
    property IntegerProp: integer read FInteger write FInteger; end; 
    procedure Register; implementation 
    procedure TEverything.Loaded; begin 
    inherited Loaded; 
    if IntegerProp = 5 then 
    Color := clRed else 
    Color := clGreen; end; 
    procedure Register; begin 
    RegisterComponents('UD3', [TEverything]) ; end; 
    end. 


      

         ,  
  .        
      ,    
.          
 ,      ,  
        . 
          
         
         
  . 

      

           Object Pascal.   
       : , 
, ,   .   
     4, "Object Pascal:  
",         
    .          
,       . 
       
         . 
 ,         
 VCL Delphi, -    , 
 . ,        
 ,         
    ,       
   . 


    372	 IV.   


       

             
 _    ,      
-.      
    (error 210),     . 

    type 
    TCustomGrid = class(TCustomControl) 
    protected 
    procedure DrawCell(ACol, ARow: Longint; ARect: TRect; 
    AState: TGridDrawState); virtual; abstract; 
    end; 

    TCustomGrid,  ,      Delphi, 
    DrawCell.  DrawCell  
 Paint      .  TCustomGrid 
   DrawCell,     
_..?._. . ^^. 
        TDrawGrid  
TString-Grid:      f CusfomS"rld    
  . 
     Delphi   ,    
 ,      J   .    
       . *      
     210.         "	"""*" 

       

         ,     
   . ,     
private,    ,     
. ,     protected,    
,    ,     . , 
    public,    . 
      private,     
 protected,     (,   
  ),      ,  
 public.    published     
  ?\1^	" 
     ^      
 protected   -      \    pub lie.	" 

      

             
     ,    
.       
  ,       , 
   ,  , ,   
 .    ,   ""  
       Events   
.     ,    
)9^_;     .  
      ,   .  
   ,     
 .   ,     
   . 
            On,  
        ,    On. 
         Click  
  OnClick. 

      

           , 
   ,      ,  
 ,    .   
    (virtual)   
(protected),     -,   
.  ,    (   
),   ,       
  .       
 published,      

     16.  	373 

,    ,      
protected,  -       
 .   ,    TControl, 
    VCL. 

    TMouseEvent  = procedure   (Sender:   TObject;   Button:   TMouseButton; 
    Shift:   TShiftState;   X,   Y:   Integer)   of object; TMouseMoveEvent  = 
 procedure   (Sender:   TObject;   Shift:   TShiftState; 
    X,   Y:   Integer)   of  object; TNotifyEvent  = procedure   (Sender:   
TObject)   of  object; 
    TControl  = class(TComponent) private 
    JjpnMouseDown:   TMouseEvent; FOnMouseMove:   TMouseMoveEvent; FOnMouseUp: 
  TMouseEvent; FOnClick:   TNotifyEvent; FOnDblClick:   TNotifyEvent; 
    protected 
    property OnClick: TNotifyEvent read FOnClick write FOnClick; property 
OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick; property 
OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown; property 
OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove; property 
OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp; 
    end; 

     Delphi  yyeoeJCJc^c^pJJJ^Kl^?oJ^ec  
_,       Events  
.    ,        
 , _    .      
    " . "  
     '(private)      
  ,    . 

       

    ,        
      ,   
 - ,       
      .  
       . 
     ,   
      .  
    ,    
,     .      
 ,     "  -~~  
  .        
 Click,     16.9.     
  . 

     16.9. \UDELPHl3\CHP16\LIST16-9. TTimeButton  
      

    TTimeButton = class(TButton) protected 
    procedure Click; override; end; 
    procedure TTimeButton.Click; begin 
    inherited Click; 
    Caption := DateTimeToStr(Now); end; 

       ,    Click   
 .  ,    ,  
     OnClick,    
   .    ,     
,         . 

    374	 IV.   


      

        .       
  ,  ,   ,   
.        , 
      .  
      ,  
 .      . 
   ,        
 .        
   . 

    procedure TSomeObject.EventDispatch; begin 
    //  ,   FOnEventHandler       TNotifyEvent. 
    //       . 
    if Assigned(FOnEventHandler)   then FOnEventHandler(Self); 
    //      ,       . end; 

             
.        
.     ,   
   .      .  
          
 .         
,    VCL  .   ,  
,        ,   
  ,  :       
     .	*~~ -- " 

      

         .    
          
   .       
,         
.     ,    .  
 ,        ,   
 ,       ,  
,.        
       .   
,        ,   
        . 
    ~66  ,    
     ,     
.     ,  ,    
       .   
     , " ".   
   . 
     ,    ,  
    .      
 ,   ,  
  ,       .. 
       ^_  
  Parent.        
,  , , ~  , 
,        ( Top, 
Left, Enabled  Visible).  16.10    ,  
      TEverything.   
    . 

     16.10. \UDELPHI3\CHP16\LIST16-10.    
 TEverything	! unit  Unitl; 

    interface 
    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; 


     16.  	375 

    type 
    TForml = class(TForm) 
    Buttonl: TButton; 
    Button2: TButton; 
    Button3: TButton; 
    Button4: TButton; 
    procedure ButtonlClick(Sender: TObject); 
    procedure Button2Click(Sender: TObject); 
    procedure ButtonSClick(Sender: TObject); 
    procedure Button4Click(Sender: TObject); private 
    (  . } public 
    {  . } end; 
    var 
    Forml: TForml; 
    implementation uses EvryThng; {$R *.DFM} 
    var 
    Everything : TEverything; 
    procedure TForml.ButtonlClick(Sender: TObject); begin 
    //    Everything. Everything := 
TEverything.Create(Self); //    Everything, with 
Everything do begin Parent := Self; Left := 20; Top := 20; Height := 40; Width 
:= 100; Color := clBlue; NumberProp := 5; end; end; 
    procedure TForml.Button2Click(Sender: TObject); begin 
    if Assigned(Everything) then 
    Caption := IntToStr(Everything.NumberProp); end; 
    procedure TForml.Button3Click(Sender: TObject); begin 
    if Assigned(Everything) then Everything.color := clRed; end; 
    procedure TForml.Button4Click(Sender: TObject); begin 
    EveryThing.Free; end; 
    end. 


    376  IV.   


       

     Delphi      ,   
  OCR- (Delphi Component Resource),     
   . OCR-     
^-_?_595_(-).  Delphi   OCR-,   
        
 .  OCR-   16-  
256-   24x24 .   16- 
,  256-    ,   
 16 ,     256      
     . 
             
,   .     
 TEverything,   . 
    1.      (Image Editor),   Tools^lmacje^Editor. 
    2.        File^New^Delphi Component 
Resource File. 
    3.      New Bitmap,   
Resource^NewoBitmap.       Bitmapl. 
    4.	     Bitmapl   24,   
  16  256. 
    5.	    Bitmapl      
 . 
    6.	  Bitmapl  TEVERYTHING. 
    7.	  File^Save As   EvryThng. OCR. 
        OCR-     PAS-  
,     . 
     Delphi     ,   
         .  
        ,  , 
"". Delphi   clOlive      
  . 
    I  1 

      

       Delphi      
     DLL.  Delphi 3,66? 
 (Component Library.)  ,      
15, "  ".  . 16.1     
Delphi   ,      
 .      Install  
  ,         
  .      ,  
,    . 16.6. 

    ', Into easting package   Wo new package 
    Rename:     ]UDelphi3dpk 
    ?(owse... 
    ?>esctiption:  I Examples Ira SE Using Delphi 3 
    Cancel 
     

    . 16.6.   Install 

               
,      Delphi  ComponentOlnstall 
Component,    .   
    ,    . 
    ? 

     16.   377 


     

              
     Delphi.  ,   
         VCL. 
  ,    ,    
  ,         
  Delphi.       
      ,  
  . 
    ,   ,    
Delphi TApplication. TAppli-cation   ,   " " 
     Delphi.    
  ,       
.  Delphi     TApplication, 
        .  
    OnCreate     . 
        TApplicationComp,  
        . 
   ,      
 TComponent.         
 TApplication          
  TApplication   Loaded.   ,  
   ,     ,   
  16.11. 


     16.11. \UDELPHI3\CHP16\LIST16-11.   TApplicationComp 

    unit AppCompU; interface 
    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; 
    type 
    TApplicationComp = class(TComponent) private 
    {  . } 
    FAllowTesting: Boolean; 
    FHint: string; 
    FHintColor: TColor; 
    FHintPause: Integer; 
    FHintShortPause: Integer; 
    FHintHidePause: Integer; 
    FShowHint: Boolean; 
    FShowMainForm: Boolean; 
    FUpdateFormatSettings: Boolean; 
    FUpdateMetricSettings: Boolean; 
    FOnActivate: TNotifyEvent; ' FOnDeactivate: TNotifyEvent; 
    FOnException: TExceptionEvent; 
    FOnldle: TIdleEvent; 
    FOnHelp: THelpEvent; 
    FOnHint: TNotifyEvent; 
    FOnMessage: TMessageEvent; 
    FOnMinimize: TNotifyEvent; 
    FOnRestore: TNotifyEvent; 
    FOnShowHint: TShowHintEvent; protected 
    {  . } 
    procedure Loaded; override; public 
    {  . } published 
    {  . } 
    // . 


    378	 IV.   


    property AllowTesting: Boolean read FAllowTesting write FAllowTesting; 
    property Hint: string read FHint write FHint; 
    property HintColor: TColor read FHintColor write FHintColor; 
    property HintPause: Integer read FHintPause write FHintPause; 
    property HintShortPause: Integer read FHintShortPause write FHintShortPause; 
    property HintHidePause: Integer read FHintHidePause write FHintHidePause; 
    property ShowHint: Boolean read FShowHint write FShowHint; 
    property ShowMainForm: Boolean read FShowMainForm write FShowMainForm; 
    property UpdateFormatSettings: Boolean read FUpdateFormatSettings 
    write FUpdateFormatSettings; property UpdateMetricSettings: Boolean read FUpdateMetricSettings 
    write FUpdateMetricSettings; 
    // . 
    property OnActivate: TNotifyEvent read FOnActivate write FOnActivate; 
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate; 
property OnException: TExceptionEvent read FOnException write FOnException; 
property Onldle: TIdleEvent read FOnldle write FOnldle; property OnHelp: 
THelpEvent read FOnHelp write FOnHelp; property OnHint 
    : TNotifyEvent read FOnHint write FOnHint; property OnMessage: 
TMessageEvent read FOnMessage write FOnMessage; property OnMinimize: 
TNotifyEvent read FOnMinimize write FOnMinimize; property OnRestore: 
TNotifyEvent read FOnRestore write FOnRestore; property OnShowHint: 
TShowHintEvent read FOnShowHint write FOnShowHint; end; 
    procedure Register; implementation 
    procedure TApplicationComp.Loaded; begin 
    //  . 
    if FAllowTesting <> Application.AllowTesting then 
    Application.AllowTesting := FAllowTesting; if FHint <> '' then 
    Application.Hint := FHint; if FHintColor <> Application.HintColor then 
    Application.HintColor := FHintColor; if FHintPause <> 
Application.HintPause then 
    Application.HintPause := FHintPause; if FHintShortPause <> 
Application.HintShortPause then 
    Application.HintShortPause := FHintShortPause; if FHintHidePause <> 
Application.HintHidePause then 
    Application.HintHidePause := FHintHidePause; if FShowHint <> 
Application.ShowHint then 
    Application.ShowHint := FShowHint; if FShowMainForm <> 
Application.ShowMainForm then 
    Application.ShowMainForm := FShowMainForm; if FUpdateFormatSettings <> 
Application.UpdateFormatSettings then 
    Application.UpdateFormatSettings := FUpdateFormatSettings; if 
FUpdateMetricSettings <> Application.UpdateMetricSettings then 
    Application.UpdateMetricSettings := FUpdateMetricSettings; 
    //  . 
    if Assigned(FOnActivate)then 
    Application.OnActivate := FOnActivate; if Assigned(FOnDeactivate)then 
    Application.OnDeactivate := FOnDeactivate; if Assigned(FOnException)then 
    Application.OnException := FOnException; if Assigned(FOnldle)then 
    Application.Onldle := FOnldle; if Assigned(FOnHelp)then 
    Application.OnHelp := FOnHelp; 


     16.  	379 


    if Assigned(FOnHint)then 
    Application.OnHint := FOnHint; if Assigned(FOnMessage)then 
    Application.OnMessage := FOnMessage; if Assigned(FOnMinimize)then 
    Application.OnMinimize := FOnMinimize; if Assigned(FOnRestore)then 
    Application.OnRestore := FOnRestore; if Assigned(FOnShowHint)then 
    Application.OnShowHint := FOnShowHint; end; 
    procedure Register; begin 
    RegisterComponents('UD3', [TApplicationComp]) end; 
    end. 


    380  IV.   

