unit CadDrawGDIDemoUnit1;

interface

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls,  ComCtrls, Menus, Buttons,
   QCadDrawGDI,QCadGDITypes, CadCalcGDI, CadDrawControl;


type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    ColorDialog1: TColorDialog;
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    SaveCAD: TMenuItem;
    LoadCAD: TMenuItem;
    SaveBMP1: TMenuItem;
    SaveGIF1: TMenuItem;
    View1: TMenuItem;
    TopView1: TMenuItem;
    FrontView1: TMenuItem;
    SideView1: TMenuItem;
    ISOView1: TMenuItem;
    BackgroundColor1: TMenuItem;
    Zoom1: TMenuItem;
    ZoomAll1: TMenuItem;
    ZoomHalf1: TMenuItem;
    ZoomDouble1: TMenuItem;
    Redraw1: TMenuItem;
    Draw1: TMenuItem;
    Point1: TMenuItem;
    Line1: TMenuItem;
    Arc1: TMenuItem;
    Axis1: TMenuItem;
    ZoomWindow1: TMenuItem;
    CurrentColor1: TMenuItem;
    PrintCad1: TMenuItem;
    PrintBitmap1: TMenuItem;
    SendtoClipboard1: TMenuItem;
    Metafile1: TMenuItem;
    Bitmap1: TMenuItem;
    SaveJPEG1: TMenuItem;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    GroupBox4: TGroupBox;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    Button3: TButton;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    GroupBox5: TGroupBox;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Button4: TButton;
    Edit7: TEdit;
    Button5: TButton;
    Button8: TButton;
    CheckBox6: TCheckBox;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    TabSheet3: TTabSheet;
    GroupBox6: TGroupBox;
    Button9: TButton;
    Button10: TButton;
    Edit12: TEdit;
    Label26: TLabel;
    Label27: TLabel;
    Edit13: TEdit;
    CheckBox7: TCheckBox;
    Button11: TButton;
    Label28: TLabel;
    Edit14: TEdit;
    TabSheet4: TTabSheet;
    GroupBox7: TGroupBox;
    Label25: TLabel;
    Label29: TLabel;
    Label30: TLabel;
    Edit11: TEdit;
    Edit15: TEdit;
    Edit16: TEdit;
    Button12: TButton;
    Button14: TButton;
    CadDrawGDI1: TCadDrawGDI;
    CadCalcGDI1: TCadCalcGDI;
    TabSheet5: TTabSheet;
    CadDrawGDI2: TCadDrawGDI;
    Label31: TLabel;
    Button13: TButton;
    Button15: TButton;
    Button16: TButton;
    Label32: TLabel;
    Label33: TLabel;
    Label36: TLabel;
    Label34: TLabel;
    Label35: TLabel;
    CheckBox9: TCheckBox;
    Button17: TButton;
    Button18: TButton;
    MergeCAD1: TMenuItem;
    Demo1: TTabSheet;
    GroupBox3: TGroupBox;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Button2: TButton;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    GroupBox1: TGroupBox;
    Label10: TLabel;
    Label11: TLabel;
    Edit2: TEdit;
    Edit3: TEdit;
    Button7: TButton;
    GroupBox2: TGroupBox;
    Label8: TLabel;
    Label9: TLabel;
    Edit1: TEdit;
    Button6: TButton;
    GroupBox8: TGroupBox;
    Button1: TButton;
    Label19: TLabel;
    Label20: TLabel;
    CheckBox8: TCheckBox;
    CheckBox1: TCheckBox;
    Label1: TLabel;
    BitBtn1: TBitBtn;
    procedure Button15Click(Sender: TObject);
    procedure Button13Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure CadDrawGDI1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure CadDrawGDI1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure LoadCADClick(Sender: TObject);
    procedure Redraw1Click(Sender: TObject);
    procedure CadDrawGDI1Zoom(Sender: TObject; Size, CenterX,
      CenterY: Double);
    procedure ZoomAll1Click(Sender: TObject);
    procedure ZoomHalf1Click(Sender: TObject);
    procedure ZoomDouble1Click(Sender: TObject);
    procedure Axis1Click(Sender: TObject);
    procedure SaveBMP1Click(Sender: TObject);
    procedure SaveGIF1Click(Sender: TObject);
    procedure BackgroundColor1Click(Sender: TObject);
    procedure FrontView1Click(Sender: TObject);
    procedure SideView1Click(Sender: TObject);
    procedure TopView1Click(Sender: TObject);
    procedure ISOView1Click(Sender: TObject);
    procedure ZoomWindow1Click(Sender: TObject);
    procedure Point1Click(Sender: TObject);
    procedure Line1Click(Sender: TObject);
    procedure Arc1Click(Sender: TObject);
    procedure CurrentColor1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure CadDrawGDI1ChangeView(Sender: TObject; NewView: TDView);
    procedure SaveCADClick(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure CadDrawGDI1Pick(Sender: TObject; ElementNumber: Integer;
      NearEnd, FarEnd, Mid, Closest: TDPoint);
    procedure Metafile1Click(Sender: TObject);
    procedure Bitmap1Click(Sender: TObject);
    procedure SaveJPEG1Click(Sender: TObject);
    procedure CadDrawGDI1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure PrintCad1Click(Sender: TObject);
    procedure PrintBitmap1Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure Button12Click(Sender: TObject);
    procedure Button14Click(Sender: TObject);
    procedure CheckBox8Click(Sender: TObject);
    procedure Button16Click(Sender: TObject);
    procedure CheckBox9Click(Sender: TObject);
    procedure Button17Click(Sender: TObject);
    procedure MergeCAD1Click(Sender: TObject);
    procedure Button18Click(Sender: TObject);
  private
    { Private declarations }
   function GetCADFilename:string;
   procedure Set_Boxes;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses CadDrawGDIDemoUnit2, CadDrawGDIDemoUnit3, CadDrawGDIDemoUnit4;
var
zooming:boolean=false;
zoom_point1, zoom_point2:TPoint;
zoom_flag:boolean=false;

{$R *.dfm}

procedure TForm1.Set_Boxes;
begin
 edit1.text:=Format('%8.3f', [CadDrawGDI1.ViewSize]);
 edit2.text:=Format('%8.3f', [CadDrawGDI1.CenterX]);
 edit3.text:=Format('%8.3f', [CadDrawGDI1.CenterY]);
end;

procedure TForm1.Button7Click(Sender: TObject);
var x,y:double;
begin
 x:=strtofloat(edit2.text);
 y:=strtofloat(edit3.text);
 CadDrawGDI1.ViewCenter(x,y);
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
 CadDrawGDI1.ViewSize:=strtofloat(edit1.text);
 label20.Caption:=inttostr(CadDrawGDI1.ElementCount);
end;

procedure TForm1.CadDrawGDI1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 CadDrawGDI1.Cursor:=crDefault;
 if zooming then
  begin
   zooming:=false;
   cursor:=crDefault;
   canvas.brush.style:=bsClear;
   canvas.Pen.Style:=psdot;
   canvas.pen.mode:=pmnot;
   canvas.rectangle(zoom_point1.x,zoom_point1.y,zoom_point2.x,zoom_point2.y);
   CadDrawGDI1.ZoomWindow(zoom_point1.x,zoom_point1.y,zoom_point2.x,zoom_point2.y);
  end;
 set_boxes;
end;


procedure TForm1.CadDrawGDI1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 if zoom_flag then zooming:=true;
 if zooming then
  begin
   zoom_flag:=false;
   zoom_point1.x:=x;
   zoom_point1.y:=y;
   zoom_point2.x:=x;
   zoom_point2.y:=y;
  end;
end;

procedure TForm1.CadDrawGDI1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var tdp:TDPoint;
begin
 if zooming then
 begin
  canvas.brush.style:=bsClear;
  canvas.Pen.Style:=psdot;
  canvas.pen.mode:=pmnot;
  canvas.rectangle(zoom_point1.x,zoom_point1.y,zoom_point2.x,zoom_point2.y);
  zoom_point2.x:=x;
  zoom_point2.y:=y;
  canvas.rectangle(zoom_point1.x,zoom_point1.y,zoom_point2.x,zoom_point2.y);
 end;

 if checkbox1.checked then
  begin
   tdp:=CadDrawGDI1.PixelToCoord(x,y);
   label1.caption:=Format('X%8.3f Y%8.3f Z%8.3f', [tdp.x,tdp.y,tdp.z]);
  end;
end;

function TForm1.GetCADFilename:string;
var ext:string;
begin
 result:='';
   OpenDialog1.Filter := 'CDL Files (*.cdl)|*.cdl|DXF Files (*.dxf)|*.dxf|IGES Files (*.igs)|*.igs|ALL Files (*.*)|*.*';
  OpenDialog1.FilterIndex := 1;
  OpenDialog1.DefaultExt:='.cdl';
 if opendialog1.Execute then
  begin
   ext:=uppercase(extractfileext(OpenDialog1.Filename));
   if ext='.CDL' then CadDrawGDI1.CadType:=CDL
   else
   if ext='.DXF' then CadDrawGDI1.CadType:=DXF
   else
   if ext='.IGS' then CadDrawGDI1.CadType:=IGES
   else
    CadDrawGDI1.CadType:=CDL;

   result:=opendialog1.filename;
  end;
end;

procedure TForm1.LoadCADClick(Sender: TObject);
var filename:string;
begin
 filename:=GetCADFilename;
if filename>'' then
 begin
  CadDrawGDI1.LoadFromFile(filename);
  CadDrawGDI1.Zoomall;
 end;
end;

procedure TForm1.Redraw1Click(Sender: TObject);
begin
 CadDrawGDI1.Redraw;
end;

procedure TForm1.CadDrawGDI1Zoom(Sender: TObject; Size, CenterX,
  CenterY: Double);
begin
 set_boxes;
end;

procedure TForm1.ZoomAll1Click(Sender: TObject);
begin
 CadDrawGDI1.ZoomAll;

end;

procedure TForm1.ZoomHalf1Click(Sender: TObject);
begin
 CadDrawGDI1.ZoomHalf;

end;

procedure TForm1.ZoomDouble1Click(Sender: TObject);
begin
 CadDrawGDI1.ZoomDouble;

end;

procedure TForm1.Axis1Click(Sender: TObject);
begin
 axis1.Checked:=not axis1.checked;
 CadDrawGDI1.ShowAxis:=axis1.checked;
 case axis1.Checked of
  true:CadDrawGDI1.DrawAxis;
  false:CadDrawGDI1.Redraw;
 end;

end;

procedure TForm1.SaveBMP1Click(Sender: TObject);
begin
  SaveDialog1.Filter := 'BMP Files (*.bmp)|*.bmp|GIF Files (*.gif)|*.gif|JPEG Files {*.jpg)|*.jpg|ALL Files (*.*)|*.*';
  SaveDialog1.DefaultExt:='.bmp';
  SaveDialog1.FilterIndex := 1;

 if SaveDialog1.Execute then
  CadDrawGDI1.SaveBMP(SaveDialog1.filename);

end;

procedure TForm1.SaveGIF1Click(Sender: TObject);
begin
  SaveDialog1.Filter := 'BMP Files (*.bmp)|*.bmp|GIF Files (*.gif)|*.gif|JPEG Files {*.jpg)|*.jpg|ALL Files (*.*)|*.*';
  SaveDialog1.DefaultExt:='.gif';
  SaveDialog1.FilterIndex := 2;

 if SaveDialog1.Execute then
  CadDrawGDI1.SaveGIF(SaveDialog1.filename);

end;

procedure TForm1.BackgroundColor1Click(Sender: TObject);
begin
 if colordialog1.Execute then
  begin
   CadDrawGDI1.BackgroundColor:=colordialog1.Color;
  end;
end;

procedure TForm1.FrontView1Click(Sender: TObject);
begin
 CadDrawGDI1.View:=vFRONT;
end;

procedure TForm1.SideView1Click(Sender: TObject);
begin
 CadDrawGDI1.View:=vSIDE;
end;

procedure TForm1.TopView1Click(Sender: TObject);
begin
 CadDrawGDI1.View:=vTOP;
end;

procedure TForm1.ISOView1Click(Sender: TObject);
begin
 CadDrawGDI1.View:=vISO;
end;

procedure TForm1.ZoomWindow1Click(Sender: TObject);
begin
 CadDrawGDI1.cursor:=crHandPoint;
 zoom_flag:=true;
end;

procedure TForm1.Point1Click(Sender: TObject);
begin
 form2.showmodal;
end;

procedure TForm1.Line1Click(Sender: TObject);
begin
 form3.showmodal;
end;

procedure TForm1.Arc1Click(Sender: TObject);
begin
 form4.showmodal;
end;

procedure TForm1.CurrentColor1Click(Sender: TObject);
begin
 if colordialog1.Execute then
  begin
   CadDrawGDI1.DrawColor:=colordialog1.Color;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 CadDrawGDI1.RotateView(strtofloat(edit4.text),strtofloat(edit5.text),
                        strtofloat(edit6.text));
end;

procedure TForm1.CadDrawGDI1ChangeView(Sender: TObject; NewView: TDView);
begin
 edit4.text:=Format('%8.3f', [CadDrawGDI1.XRotation]);
 edit5.text:=Format('%8.3f', [CadDrawGDI1.YRotation]);
 edit6.text:=Format('%8.3f', [CadDrawGDI1.ZRotation]);

end;

procedure TForm1.SaveCADClick(Sender: TObject);
var ext:string;
begin
  SaveDialog1.Filter := 'CDL Files (*.cdl)|*.cdl|DXF Files (*.dxf)|*.dxf|IGES Files (*.igs)|*.igs|ALL Files (*.*)|*.*';
  SaveDialog1.FilterIndex := 1;
  SaveDialog1.DefaultExt:='.cdl';
 if SaveDialog1.Execute then
  begin
   ext:=uppercase(extractfileext(SaveDialog1.Filename));
   if ext='.CDL' then CadDrawGDI1.CadType:=1
   else
   if ext='.DXF' then CadDrawGDI1.CadType:=2
   else
   if ext='.IGS' then CadDrawGDI1.CadType:=3
   else
    CadDrawGDI1.CadType:=1;

   CadDrawGDI1.SaveToFile(SaveDialog1.Filename);
  end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
 CadDrawGDI1.PickFilter:=fAll;
 if checkbox2.checked then CadDrawGDI1.PickFilter:=fPoints;
 if checkbox3.checked then CadDrawGDI1.PickFilter:=fLines;
 if checkbox4.checked then CadDrawGDI1.PickFilter:=fArcs;
 if (checkbox2.checked)and(checkbox3.checked)then CadDrawGDI1.PickFilter:=fPointLine;
 if (checkbox2.checked)and(checkbox4.checked)then CadDrawGDI1.PickFilter:=fPointArc;
 if (checkbox3.checked)and(checkbox4.checked)then CadDrawGDI1.PickFilter:=fLineArc;
 if (checkbox2.checked)and(checkbox3.checked)and(checkbox4.checked)then CadDrawGDI1.PickFilter:=fAll;
 CadDrawGDI1.Cursor:=crCross;
 CadDrawGDI1.Pick;
end;


procedure TForm1.CadDrawGDI1Pick(Sender: TObject; ElementNumber: Integer;
  NearEnd, FarEnd, Mid, Closest: TDPoint);
var e:TElement;
 Line1:TDLine;
 Point1,Point2:TDPoint;
 Arc1,Arc2:TDArc;
 i:integer;
begin
 label34.caption:='';
 label35.caption:='';
 e:=CadDrawGDI1.Elements[ElementNumber];
 CadDrawGDI1.DrawColor:=clYellow;
 case e.etype of
  1:
   begin
    CadDrawGDI1.DrawPoint(e.coord[1],e.coord[2],e.coord[3]);
    label17.caption:='Point['+inttostr(ElementNumber)+']';
    if checkbox5.checked then
     begin
      for i:=1 to 5 do
       begin
        CadCalcGDI1.LinePointAngle(CadCalcGDI1.PointFromElement(e),(360/5)*i,CadDrawGDI1.ViewSize/2,Line1);
        CadDrawGDI1.DrawLineX(Line1);
        CadDrawGDI1.DrawPointX(Line1.Point2);
        CadDrawGDI1.MakePointX(Line1.Point2);
       end;
     end;
   end;
  2:
   begin
    CadDrawGDI1.DrawLine(e.coord[1],e.coord[2],e.coord[3],e.coord[4],e.coord[5],e.coord[6]);
    label17.caption:='Line['+inttostr(ElementNumber)+']';
    if checkbox5.checked then
     begin
      Point1:=CadCalcGDI1.PointFromElement(e);
      Point2.x:=e.coord[4]; Point2.y:=e.coord[5]; Point2.z:=e.coord[6];
      CadCalcGDI1.ArcBetween2Points(Point1,Point2,0,360,Arc1);
      CadDrawGDI1.DrawArcX(Arc1);
      CadCalcGDI1.ArcThrough2Points(Point1,Point2,CadCalcGDI1.Distance2Points(Point1,Point2),0,360,Arc1,Arc2);
      CadDrawGDI1.DrawColor:=clred;
      CadDrawGDI1.DrawArcX(Arc1);
      CadDrawGDI1.DrawArcX(Arc2);
      CadDrawGDI1.MakeArcX(Arc2);
     end;
   end;
  3:
   begin
    CadDrawGDI1.DrawArc(e.view,e.coord[1],e.coord[2],e.coord[3],e.coord[4],e.coord[5],e.coord[6]);
    label17.caption:='Arc['+inttostr(ElementNumber)+']';
    label34.caption:=format('Start Angle = %8.3f',[e.Coord[5]]);
    label35.caption:=format('End Angle = %8.3f',[e.Coord[6]]);
    if checkbox5.checked then
     begin
      Point1:=CadCalcGDI1.PointFromElement(e);
      CadCalcGDI1.Line2Points(Closest,Point1,Line1);
      CadDrawGDI1.DrawLineX(Line1);
      CadDrawGDI1.MakeLineX(Line1);
     end;
   end;
 end;
 label13.caption:=format('X%8.3fY%8.3fZ%8.3f',[NearEnd.x,NearEnd.y,NearEnd.z]);
 label14.caption:=format('X%8.3fY%8.3fZ%8.3f',[FarEnd.x,FarEnd.y,FarEnd.z]);
 label15.caption:=format('X%8.3fY%8.3fZ%8.3f',[Mid.x,Mid.y,Mid.z]);
 label16.caption:=format('X%8.3fY%8.3fZ%8.3f',[Closest.x,Closest.y,Closest.z]);

 CadDrawGDI1.Cursor:=crDefault;
end;

procedure TForm1.MergeCAD1Click(Sender: TObject);
var filename:string;
begin
 filename:=GetCADFilename;
if filename>'' then
 begin
  CadDrawGDI1.MergeFile(filename);
  CadDrawGDI1.Zoomall;
 end;
end;

procedure TForm1.Metafile1Click(Sender: TObject);
begin
 CadDrawGDI1.WmfToClipboard;
end;

procedure TForm1.Bitmap1Click(Sender: TObject);
begin
 CadDrawGDI1.BmpToClipboard;
end;

procedure TForm1.SaveJPEG1Click(Sender: TObject);
begin
  SaveDialog1.Filter := 'BMP Files (*.bmp)|*.bmp|GIF Files (*.gif)|*.gif|JPEG Files {*.jpg)|*.jpg|ALL Files (*.*)|*.*';
  SaveDialog1.DefaultExt:='.gif';
  SaveDialog1.FilterIndex := 3;

 if SaveDialog1.Execute then
  CadDrawGDI1.SaveJPEG(SaveDialog1.filename);

end;

procedure TForm1.PrintCad1Click(Sender: TObject);
begin
 CadDrawGDI1.PrintCad;
end;

procedure TForm1.PrintBitmap1Click(Sender: TObject);
begin
 CadDrawGDI1.PrintBMP;
end;



procedure TForm1.Button4Click(Sender: TObject);
begin
 CadDrawGDI1.AddToGroup(0);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
 CadDrawGDI1.RotateGroup(strtofloat(edit7.Text),
      strtofloat(edit8.Text),strtofloat(edit9.Text),
      strtoint(edit10.Text),checkbox6.Checked);
 CadDrawGDI1.Redraw;
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
 CadDrawGDI1.ClearGroup;
end;

procedure TForm1.Button11Click(Sender: TObject);
begin
 CadDrawGDI1.ShiftGroup(strtofloat(edit12.Text),strtofloat(edit13.Text),
      0,strtoint(edit14.Text),checkbox7.Checked);
end;

procedure TForm1.Button12Click(Sender: TObject);
begin
 CadDrawGDI1.NewOrigin(strtofloat(edit11.Text),strtofloat(edit15.Text),strtofloat(edit16.Text));
 CadDrawGDI1.SetExtents;
end;

procedure TForm1.Button13Click(Sender: TObject);
var ext:string;
begin
  OpenDialog1.Filter := 'CDL Files (*.cdl)|*.cdl|DXF Files (*.dxf)|*.dxf|IGES Files (*.igs)|*.igs|ALL Files (*.*)|*.*';
  OpenDialog1.FilterIndex := 1;
  OpenDialog1.DefaultExt:='.cdl';
 if opendialog1.Execute then
  begin
   ext:=uppercase(extractfileext(OpenDialog1.Filename));
   if ext='.CDL' then CadDrawGDI2.CadType:=1
   else
   if ext='.DXF' then CadDrawGDI2.CadType:=2
   else
   if ext='.IGS' then CadDrawGDI2.CadType:=3
   else
    CadDrawGDI2.CadType:=1;

  CadDrawGDI2.LoadFromFile(opendialog1.filename);
  CadDrawGDI2.Zoomall;
 end;
end;

procedure TForm1.Button14Click(Sender: TObject);
begin
 CadDrawGDI1.deleteGroup;
end;

procedure TForm1.Button15Click(Sender: TObject);
begin
  CadDrawGDI1.SetExtents;
end;

procedure TForm1.CheckBox8Click(Sender: TObject);
begin
 CadDrawGDI1.AntiAlias:=checkbox8.Checked;
end;

procedure TForm1.Button16Click(Sender: TObject);
begin
 label33.Caption:= format('Max=X%8.3fY%8.3f',[CadDrawGDI1.CadSettings.max_x,CadDrawGDI1.CadSettings.max_y]);
 label36.Caption:= format('Min=X%8.3fY%8.3f',[CadDrawGDI1.CadSettings.min_x,CadDrawGDI1.CadSettings.min_y]);
end;

procedure TForm1.CheckBox9Click(Sender: TObject);
begin
 CadDrawGDI1.CadSettings.linearcs:=checkbox9.checked;
end;

procedure TForm1.Button17Click(Sender: TObject);
begin
 CadDrawGDI1.ClearElements;
end;

procedure TForm1.Button18Click(Sender: TObject);
begin
CadDrawGDI1.redraw;
end;

end.
