home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programming Unleashed / Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso / misc / objects / frm2comp / newcomp < prev    next >
Encoding:
Text File  |  1995-03-21  |  1.8 KB  |  99 lines

  1. unit NewComp;
  2. {
  3.   This a form that has been converted into a component.
  4.   You can still edit in the form designer as if it were a 
  5.   form.
  6.  
  7.   Make sure that its DFM file does not include the
  8.   following lines:
  9.  
  10.     PixelsPerInch = 96
  11.     TextHeight = 16
  12.   
  13.   To get rid of them, you need to translate the DFM file
  14.   to text, and then delete them, then translate the file
  15.   back into a DFM file. Do it either in the editor, or
  16.   else use the CONVERT.EXE command line utility.
  17.  
  18.   Inside the DFM file, give the main object its own name:
  19.  
  20. object Form2: TForm2
  21.   Left = 15
  22.   Top = 22
  23.   Width = 435
  24.   Height = 300
  25.   Caption = 'Form2'
  26.   Font.Color = clWindowText
  27.   Font.Height = -13
  28.   Font.Name = 'System'
  29.   Font.Style = []
  30.   object SpeedButton1: TSpeedButton
  31.     Left = 168
  32.     Top = 96
  33.     Width = 25
  34.     Height = 25
  35.   end
  36.   object BitBtn1: TBitBtn
  37.     Left = 32
  38.     Top = 24
  39.     Width = 89
  40.     Height = 33
  41.     Caption = 'BitBtn1'
  42.     TabOrder = 0
  43.   end
  44.   object BitBtn2: TBitBtn
  45.     Left = 136
  46.     Top = 24
  47.     Width = 89
  48.     Height = 33
  49.     Caption = 'BitBtn2'
  50.     TabOrder = 1
  51.   end
  52. end
  53.  
  54.  
  55. }
  56.  
  57. interface
  58.  
  59. uses
  60.   SysUtils, WinTypes, WinProcs,
  61.   Messages, Classes, Graphics,
  62.   Controls, Forms, Dialogs,
  63.   StdCtrls, Buttons, ExtCtrls;
  64.  
  65. type
  66.   TForm2 = class(TPanel)
  67.     BitBtn1: TBitBtn;
  68.     BitBtn2: TBitBtn;
  69.     SpeedButton1: TSpeedButton;
  70.   private
  71.     { Private declarations }
  72.   public
  73.     Constructor Create(AOwner: TComponent); override;
  74.     { Public declarations }
  75.   end;
  76.  
  77. var
  78.   Form2: TForm2;
  79.  
  80. procedure Register;
  81.  
  82. implementation
  83.  
  84. {$R *.DFM}
  85.  
  86. procedure Register;
  87. begin
  88.   RegisterComponents('Unleash', [TForm2]);
  89. end;
  90.  
  91. constructor TForm2.Create(AOwner: TComponent);
  92. begin
  93.   inherited Create(AOwner);
  94.   IsControl := True;
  95.   ReadComponentRes(ClassName, Self);
  96. end;
  97.  
  98. end.
  99.