home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / protview / demowinx / data.2 / line / samples / DELPHI / LINEDEMO / LINEDEM.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-10-21  |  3.3 KB  |  144 lines

  1. unit LineDem;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   OleCtrls, WinXline, StdCtrls, ExtCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Line1: TLine3D;
  12.     Line2: TLine3D;
  13.     Line3: TLine3D;
  14.     Line4: TLine3D;
  15.     Line5: TLine3D;
  16.     Line6: TLine3D;
  17.     Line7: TLine3D;
  18.     Line8: TLine3D;
  19.     Line9: TLine3D;
  20.     Line10: TLine3D;
  21.     Line3D1: TLine3D;
  22.     Line3D2: TLine3D;
  23.     Line3D3: TLine3D;
  24.     Line3D4: TLine3D;
  25.     SolidRadio: TRadioButton;
  26.     DashRadio: TRadioButton;
  27.     DotRadio: TRadioButton;
  28.     DashDotRadio: TRadioButton;
  29.     DashDotDotRadio: TRadioButton;
  30.     CloseButton: TButton;
  31.     Line3D5: TLine3D;
  32.     Line3D6: TLine3D;
  33.     Line3D7: TLine3D;
  34.     Line3D8: TLine3D;
  35.     Timer1: TTimer;
  36.     Line3D9: TLine3D;
  37.     Line3D10: TLine3D;
  38.     Line3D11: TLine3D;
  39.     Line3D12: TLine3D;
  40.     procedure Timer1Timer(Sender: TObject);
  41.     procedure FormActivate(Sender: TObject);
  42.     procedure DashDotDotRadioClick(Sender: TObject);
  43.     procedure DashDotRadioClick(Sender: TObject);
  44.     procedure DashRadioClick(Sender: TObject);
  45.     procedure DotRadioClick(Sender: TObject);
  46.     procedure SolidRadioClick(Sender: TObject);
  47.     procedure CloseButtonClick(Sender: TObject);
  48.   private
  49.     { Private declarations }
  50.     procedure ChangeLineStyle(Sender: TObject; iStyle: integer);
  51.   public
  52.     { Public declarations }
  53.   end;
  54.  
  55. var
  56.   Form1: TForm1;
  57.   iTime, iLimit, iDirection: Integer;
  58.  
  59. implementation
  60.  
  61. {$R *.DFM}
  62.  
  63. procedure TForm1.FormActivate(Sender: TObject);
  64. begin
  65.     iTime := 0;
  66.     iLimit := Line1.Width;
  67.     iDirection := iLimit div 20;
  68. end;
  69.  
  70. procedure TForm1.ChangeLineStyle(Sender: TObject; iStyle: integer);
  71. begin
  72.     Line1.LineStyle := iStyle;
  73.     Line2.LineStyle := iStyle;
  74.     Line3.LineStyle := iStyle;
  75.     Line4.LineStyle := iStyle;
  76.     Line5.LineStyle := iStyle;
  77.     Line6.LineStyle := iStyle;
  78.     Line7.LineStyle := iStyle;
  79.     Line8.LineStyle := iStyle;
  80.     Line9.LineStyle := iStyle;
  81.     Line10.LineStyle := iStyle;
  82. end;
  83.  
  84. procedure TForm1.Timer1Timer(Sender: TObject);
  85. begin
  86.     If iTime > 0 Then
  87.     begin
  88.         Line1.Width := iLimit - iTime;
  89.         Line2.Width := iLimit - iTime;
  90.         Line1.Height := iLimit;
  91.         Line2.Height := iLimit;
  92.     end
  93.     Else
  94.     begin
  95.         Line1.Width := iLimit;
  96.         Line2.Width := iLimit;
  97.         Line1.Height := iLimit + iTime;
  98.         Line2.Height := iLimit + iTime;
  99.     end;
  100.     iTime := iTime + iDirection;
  101.     If iTime >= iLimit Then
  102.     begin
  103.         iDirection := -iDirection;
  104.         iTime := iLimit;
  105.     end;
  106.     If iTime <= -iLimit Then
  107.     begin
  108.         iDirection := -iDirection;
  109.         iTime := -iLimit;
  110.     end;
  111. end;
  112.  
  113. procedure TForm1.DashDotDotRadioClick(Sender: TObject);
  114. begin
  115.      ChangeLineStyle(Sender, 4)
  116. end;
  117.  
  118. procedure TForm1.DashDotRadioClick(Sender: TObject);
  119. begin
  120.      ChangeLineStyle(Sender, 3)
  121. end;
  122.  
  123. procedure TForm1.DashRadioClick(Sender: TObject);
  124. begin
  125.      ChangeLineStyle(Sender, 1)
  126. end;
  127.  
  128. procedure TForm1.DotRadioClick(Sender: TObject);
  129. begin
  130.      ChangeLineStyle(Sender, 2)
  131. end;
  132.  
  133. procedure TForm1.SolidRadioClick(Sender: TObject);
  134. begin
  135.      ChangeLineStyle(Sender, 0)
  136. end;
  137.  
  138. procedure TForm1.CloseButtonClick(Sender: TObject);
  139. begin
  140.      Close
  141. end;
  142.  
  143. end.
  144.