home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / delphi / kompon / d3456 / GPJTLINE.ZIP / demo / Unit1.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2002-04-04  |  2.4 KB  |  108 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   line, ExtCtrls, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Line2: TLine;
  12.     Line1: TLine;
  13.     Line3: TLine;
  14.     Shape1: TShape;
  15.     Label2: TLabel;
  16.     Line4: TLine;
  17.     Label3: TLabel;
  18.     Label4: TLabel;
  19.     GroupBox1: TGroupBox;
  20.     ColorDialog1: TColorDialog;
  21.     CheckBox1: TCheckBox;
  22.     CheckBox2: TCheckBox;
  23.     RadioButton1: TRadioButton;
  24.     RadioButton2: TRadioButton;
  25.     RadioButton4: TRadioButton;
  26.     RadioButton3: TRadioButton;
  27.     Label1: TLabel;
  28.     probe: TLine;
  29.     Label5: TLabel;
  30.     Label6: TLabel;
  31.     Label7: TLabel;
  32.     Panel1: TPanel;
  33.     Panel2: TPanel;
  34.     Label8: TLabel;
  35.     Label9: TLabel;
  36.     Label10: TLabel;
  37.     Edit1: TEdit;
  38.     Label11: TLabel;
  39.     procedure Panel1Click(Sender: TObject);
  40.     procedure Panel2Click(Sender: TObject);
  41.     procedure ConfigTLine(Sender: TObject);
  42.     procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  43.     procedure Edit1KeyUp(Sender: TObject; var Key: Word;
  44.       Shift: TShiftState);
  45.   private
  46.     { Private declarations }
  47.   public
  48.     { Public declarations }
  49.   end;
  50.  
  51. var
  52.   Form1: TForm1;
  53.  
  54. implementation
  55.  
  56. {$R *.DFM}
  57.  
  58. procedure TForm1.Panel1Click(Sender: TObject);
  59. begin
  60. ColorDialog1.Color:=Probe.LineColor;
  61. if ColorDialog1.Execute then begin
  62.    Probe.LineColor:=ColorDialog1.Color;
  63.    Panel1.Color:=Probe.LineColor;
  64. end;
  65. end;
  66.  
  67. procedure TForm1.Panel2Click(Sender: TObject);
  68. begin
  69. ColorDialog1.Color:=Probe.ArrowColor;
  70. if ColorDialog1.Execute then begin
  71.    Probe.ArrowColor:=ColorDialog1.Color;
  72.    Panel2.Color:=Probe.ArrowColor;
  73. end;
  74. end;
  75.  
  76. procedure TForm1.ConfigTLine(Sender: TObject);
  77. begin
  78. Probe.Arrow1:=CheckBox1.Checked;
  79. Probe.Arrow2:=CheckBox2.Checked;
  80. if RadioButton1.Checked then
  81.    Probe.Direction:=drLeftRight
  82. else
  83. if RadioButton2.Checked then
  84.    Probe.Direction:=drUpDown
  85. else
  86. if RadioButton3.Checked then
  87.    Probe.Direction:=drTopLeftBottomRight
  88. else
  89.    Probe.Direction:=drTopRightBottomLeft
  90. end;
  91.  
  92. procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
  93. begin
  94. Case Key of
  95. '0'..'9',#13,#8:;
  96. else Key:=#0;
  97. end;
  98. end;
  99.  
  100. procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word;
  101.   Shift: TShiftState);
  102. begin
  103. if(Key=VK_Return)and(Edit1.Text<>'') then
  104.   Probe.ArrowFactor:=StrToInt(Edit1.Text);
  105. end;
  106.  
  107. end.
  108.