Manual:FAQ
From TCAD Wiki
TCAD Install and uninstall
How to install of TCAD?
TCAD xp supports three IDE:Delphi,C++Builder and Kylix.If you use it,you must install it.
1.Delphi
a.Run Delphi.
b.Select the File|Open menu option.
c.Choose the .dpk file.
d.Press "Install" button.
e.After you have installed package and start a new project, please make sure you've added package folder to your Kylix's library path setting.
2.C++Builder
a. Run C++Builder.
b. Select the File|Open Project menu option.
c. Select the .bpk file.
d. Press "Install" button.
e. After you have installed package and start a new project, please make sure you've added folder with the package folder to your C++Builder's library path setting and include directory.
Steps like this: Projects->Options->Directories/Conditionals->Include path -> add "\TCADxp\Component\cbuilderX",Library path -> add "\TCADxp\Component\cbuilderX".
3.Kylix(Delphi)
a. Run Kylix Delphi.
b. Select the File|Open menu option.
c. Choose the bplCrystalComponentK3.dpk file.
d. Press "Install" button.
e. After you have installed package and start a new project, please make sure you've added package folder to your Kylix's library path setting.
4.Kylix(BCB)
a. Run Kylix BCB.
b. Select Component|Install Packages...
c. Click the Add... button.
d.Select the bplCrystalComponentK3.so file.
e. Click the OK button.
when you first use run application with TCAD,it'll show a dialog let you choose hpp file,locate the Install directory,choose the cad.hpp file,click OK button,it runs.
How to uninstall of TCAD?
- First,select the Component Menu and choose the Install Packages... Item in develop tool,it shows a Project Options form.
- Then,select the TCAD Package for Borland Delphi&C++Builder Item in Design packages,and press "Remove" button.it will shows a confirm,press "Yes" to remove it.Press "OK" to Close this Project Options form.
- Last,delete the library path.
a. Select Tools|Environment options,it will show a dialog.
b. Click the "Library" item.press "..." button after Library path.it'll show a new dialog.
c. Choose the TCAD package folder in Ordest list of Library paths.press "Delete" button.Press "OK" button.
d. Press "OK" to sure delete the tcad library path.
I can't register tcad pro?
- You should register tcad when you purchased pro edition.
- 1. Download Register TCAD tool and run it, you'll get the computer hardware id;
- 2. Please send this hardware id to us, we will give you a serial no.
- 3. Run Register TCAD tool again,and enter the serial number to register tcad.
NOTE:
- If you use Windows Vista OS or higher, please disable UAC(user account control) by tool which you find in control panel.
Working with TCAD
How to replace the Strings Editor by yours?
- You can change STRSEDIT.dfm in the package of TCAD.but you remember that this property is TStringList type.
How to change the shape's pen and brush while dragging for TCAD?
- I'll try to move the selected shape over the screen with the visible shape like shown.it is easy to place this code to OnMouseDragging event:
- Delphi
procedure TMainFrm.MyCAD1ShapeMouseDragging(AShape: TMyShape; FromPoint, ToPoint: TPoint); begin MyCAD1.Canvas.Pen.Style :=PsSolid; end;
- C++builder:
MyCAD1->Canvas->Pen->Style =PsSolid;
- You also can change the pen.color , or other style.
How to assign UserData field to a CombineShape in Libmanager.exe?
- It is a useful function for you.To add a userdata fields to a combine shape in Libmanager.exe, you sould do it according these steps:
- 1.open the LibManager.exe;
- 2.place some shapes to design a combine shape;
- 3.Choose [Edit]->[Manage UserData] to edit your userdata then after you open this library in Edit demo,drag the combine shape,you will find them existed!
Cannot set paper size under c++ builder?
- Question:
- [C++ Error] mydyxl.cpp(296): E2015 Ambiguity between 'A4' and 'Cad::A4'
- Answer:
MyCAD1->PageStyle =Cad::A4;
How to create yourself library?
- We provide a tool named LibManager.exe,you can create yourself library by it,we provide full source of LibManager in enterprise license.
How to load shape from library?
procedure TForm1.Button1Click(Sender: TObject);
var
LibManager: TLibManager;
AShape,BShape:TMyShape;
begin
LibManager:=TLibManager.Create;
LibManager.LoadFromFile(ExtractFilePath(Application.ExeName)+'test.lib');
with MyCAD1 do
BEGIN
AShape:=GetShapeById(AddUserDefineShapefromLib(LibManager, 'NoNameShape',100,200,MyCAD1));
BShape:=GetShapeById(AddUserDefineShapefromLib(LibManager, 'NoNameShape',300,200,MyCAD1));
MyCAD1.CreateLink('Line1',AShape,8,BShape,3);
MyCAD1.CreateLink('Line2',AShape,9,BShape,4);
MyCAD1.CreateLink('Line3',AShape,10,BShape,5);
end;
LibManager.Free;
end;
How to go into effect at once when modifing properties by code?
- Sometimes,the value of property is changed,but do not go into effect at once,You can add code after set properties value.
procedure TMainFrm.Button1Click(Sender: TObject); begin (MyCAD1.GetSelectedShape as TMyRectangle).GradientStyle:=gsLinearV; MyCAD1.GetSelectedShape.Pen.Color:=clRed; MyCAD1.Repaint; end;
How to get child shapes from a grouped shape?
procedure TMainFrm.Button1Click(Sender: TObject); var i:integer; AShape:TMyShape; begin AShape:=MyCAD1.GetSelectedShape; If AShape.HasChildshapes then For i:=0 to High(AShape.ChildShapesNo) do ShowMessage((AShape.Owner as TMyCAD).GetShapeByNo(AShape.ChildShapesNo[i]).Name); end;
How to group shapes?
- First,Select some shapes that you'd like to group.
- Then,Call TMyCAD's function GroupWorkingShape.
- Code like this:
procedure TMainFrm.Button1Click(Sender: TObject); begin //if group success,then return the grouped shape no. MyCAD1.GroupWorkingShape; end;
How to manipulate selected shapes?
procedure TMainFrm.Button1Click(Sender: TObject); var mMyShapes:TArrMyShape; i:Integer; begin mMyShapes:=MyCAD1.GetSelectedShapes; for i:=0 to High(mMyShapes) do begin ShowMessage(mMyShapes[i].Name); //Do some thing end; end;
How to get all points from a shape?
procedure TMainFrm.Button1Click(Sender: TObject);
var
APoint:TMyPoint;
i:Integer;
begin
for i:=0 to MyCAD1.GetSelectedShape.GetPointsCount-1 do
begin
APoint:=MyCAD1.GetSelectedShape.GetPoint(i);
ShowMessage('X:'+FloatToStr(APoint.X)+' Y:'+FloatToStr(APoint.Y));
end;
end;
How to change border color,fill color and style of a shape?
- You can change Pen and Brush property in inspector (see it in Editor demo),but also you can do it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); var mMyShape:TMyShape; begin mMyShape:=MyCAD1.GetSelectedShape; IF mMyShape <> nil then begin mMyShape.Pen.Color:=clRed; mMyShape.Brush.Color:=clGreen; mMyShape.Brush.Style:=bsSolid; end; end;
How to move a shape by keyboard?
procedure TMainFrm.FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState); begin IF MyCAD1.GetSelectedShape <> nil then begin if (Key=37) then //Left MyCAD1.Move(MyCAD1.GetSelectedShape,-1,0); if (Key=38) then //up MyCAD1.Move(MyCAD1.GetSelectedShape,0,-1); if (Key=39) then //Right MyCAD1.Move(MyCAD1.GetSelectedShape,1,0); if (Key=40) then //down MyCAD1.Move(MyCAD1.GetSelectedShape,0,1); end end;
How to draw an image?
- Set ShapeTool property as SpImage,then you can load it by mouse.
- Also,you can do it by code.
- Code example:
procedure TMainFrm.Button6Click(Sender: TObject);
var
mBitmap:TBitmap;
begin
mBitmap:=TBitmap.Create;
mBitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+'xpatag.bmp');
if MyCAD1.GetShapeByName('ImageShape')=nil then
MyCAD1.AddImageShapeByCode('ImageShape',Point(10,10),mBitmap);
mBitmap.Free;
end;
How to draw a polybezier?
- Set ShapeTool property as SpPolyBezier,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
begin
if MyCAD1.GetShapeByName('PolyBezierShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spPolyBezier, 'PolybezierShape',
[MyPoint(330,211),MyPoint(380, 211), MyPoint(380, 270), MyPoint(530, 270)], 0);
end;
How to draw an elliarc?
- Set ShapeTool property as SpElliArc,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
begin
if MyCAD1.GetShapeByName('ElliArcShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spElliArc, 'ArcShape', [MyPoint(330, 211), MyPoint(380, 211), MyPoint(380, 270)], 0);
end;
How to draw a polyline?
- Set ShapeTool property as SpPolyLine,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
begin
if MyCAD1.GetShapeByName('PolyLineShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spPolyLine, 'PolyLineShape',
[MyPoint(90, 11), MyPoint(80,70), MyPoint(110, 120), MyPoint(10, 120)]);
end;
How to draw a rectangle?
- Set ShapeTool property as SpRectangle,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
begin
if MyCAD1.GetShapeByName('RectangleShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spRectangle, 'RectangleShape',
[MyPoint(290, 211),MyPoint(380, 211), MyPoint(380, 270), MyPoint(290, 270)], 30 * pi / 180);
end;
How to draw an ellipse?
- Set ShapeTool property as SpEllipse,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example
procedure TMainFrm.Button1Click(Sender: TObject);
begin
if MyCAD1.GetShapeByName('EllipseShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spEllipse,'EllipseShape',
[MyPoint(380, 261), MyPoint(430,261) ,MyPoint(430, 320),MyPoint(380,320)]);
end;
How to draw a ruleline?
- Set ShapeTool property as SpRuleLine,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
begin
if MyCAD1.GetShapeByName('RuleLineShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spRuleLine, 'RuleLineShape',
[MyPoint(131, 41), MyPoint(140,150)]);
end;
How to draw a line?
- Set ShapeTool property as SpLine,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
begin
if MyCAD1.GetShapeByName('LineShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spLine, 'LineShape', [MyPoint(13.11, 4), MyPoint(40, 50)]);
end;
How to set undo size?
- You can do it in inspector,UndoRedoSize property can define the undo operation capcity. it is bigger, memory costs more.
- Also,set value by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.UndoRedoSize:=20; //... end;
How to save a file or stream without background bitmap?
procedure TMainFrm.Button1Click(Sender: TObject); var FileName:String; begin FileName:='NoBkBitmap.tcad'; MyCAD1.BkBitmap:= nil; MyCAD1.SaveToFile(FileName) ;//MyCAD1.SaveToStream(AStream) end;
How to set current shape style and mode for drawing by mouse?
- When you draw a shape by mouse,you can set some properties before do it.you can change ShapeTool property whether what style of shape you will draw.ReturnToSelecting property whether change ShapeTool's value as selecting state.when you set this property as true and drawed a shape,the ShapeTool's value will set as SpSelecting of itself,or not,it do not change ShapeTool's value when you drawed a shape.
- Set Snap property as true and set SnapPixels property,set SnapShape property as true,it will snap to grid and snap to shape itwhen you draw or drag or resize a shape.
- Also,you can set this property value by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.ReturnToSelecting:=False; MyCAD1.ShapeTool:=SpEllipse; //... end;
How to control resize and rotate of a shape?
- when you drawed a shape,you can control it whether it can change its size or rotate position.in inspector,ResizeEnable can control its size,when set this property as false,it can not change size by mouse.RotateEnable is false, can not rotate it by mouse.
- Also,you can set this property value in code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.RotateEnable:=false; MyCAD1.ResizeEnable:=false; //... end;
How to get actual size of a shape?
- You can find some properties of tcad.Ratio,Zoom,TheUNIT properties are very useful when you count a actual size of a shape.
- Code example:
AShape.GetMyWidth AShape.GetMyHeight
AShape.GetWidth AShape.GetHeight
How to set print options of tcad?
- When you print a TCAD drawing,you can set parameters of printing such as page's foot,head,heigth,width,orientation,style,margin and whether print border,background for tcad.
- You can find prolific properties inspector.
PageFoot, PageFootAlignment, PageFootFont, PageFootToBottom, PageHead, PageHeadAlignment, PageHeadFont, PageHeadToTop, PageHeigth, PageOrientation, PageStyle, PageWidth, PrintABorder, PrintABordertoBottom, PrintABordertoLeft, PrintABordertoLeft, PrintABordertoRight, PrintABordertoTop, PrintBackGround.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.PageFoot:='tcad drawing example'; MyCAD1.PrintABorder:=true; //... end;
How to set current layer availably?
- When you manipulate layers,you only want to handle only for current layer,you can do it by OperateAllLayer property,when you set value as False,it only handle for current layer.or it handle all of layers.
- You can do it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.OperateAllLayer:=False; end;
How to show size when drawing a shape?
- First,drag a TLabel component to a form.
- Then,set TCAD's LabelValue property as Label1.
- Last,it will show shape's size when you add a shape.
- Also,it can do it by code.
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAd1.LabelValue:=Label1; //... end;
How to show coordinates when moving mouse on canvas?
- First,drag a TLabel component to a form.
- Then,set TCAD's LabelXY property as Label1.
- Last,it will show mouse position in TCAD when you move mouse.
- Also,it can do it by code.
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAd1.LabelXY:=Label1; //... end;
How to set grid property for TCAD?
- You can set grid in MyCAD1.Gridoperation.GridColor property can change grid's color,GridHeight property sets the grid's height,GridPenSize property sets grid's pen size,GridShow property can hide or show grid on TCAD,GridType property can change grid style property (line or point).
- Code example:
procedure TMainFrm.Button5Click(Sender: TObject); begin MyCAD1.GridOperation.GridColor:=clGreen; MyCAD1.GridOperation.GridHeight:=20; MyCAD1.GridOperation.GridWidth:=20; MyCAD1.GridOperation.GridPenSize:=2; MyCAD1.GridOperation.GridType:=gPixel //... end;
How to set drag direction when dragging a shape?
- You can set DragMode property in inspector.when set it as dgVert,it will can drag vertical,set it as dgHorz,it will can drag Horizontal,set it as dgBoth,it can drag freely.
- Also,you can set it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.DragMode:=dgVert; //... end;
How to set cross flag when two link lines across?
- you can set CrossLine property in inspector.when set it as True,it will show a ellipse angle when a link line acrossing another link line.
- Also,you can set it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.CrossLine:=True; //... end;
How to set hot that selected shape shows it?
- You can set TCAD's property in inspector,ColorOfHot property can change hot's color,HotSize property can change hot's size,HotShow property it can hide or show hot when you select shape.
- Also,you can do it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.ColorOfHot:=clRed; MyCAD1.HotSize:=8; //MyCAD1.HotShow:=False; end;
How to set background color of tcad?
- you can do it with TCAD's inspector.See ColorOfBackGround property,you can change background color by it.
- Also,you can do it by code.see it.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.ColorOfBackGround:=clYellow; end;
How to set a background bitmap of tcad?
- you can do it with TCAD's inspector.See BkBitmap property,it can load a bitmap form a file and BkBitmapMode property,it can change bitmap's show style.
- Also,you can do it by code.see it.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
var
mBitmap:TBitmap;
begin
mBitmap:=TBitmap.Create;
mBitmap.LoadFromFile('xpatag.bmp');
MyCAD1.BkBitmap:=mBitmap;
MyCAD1.BkBitmapMode:=Center;
mBitmap.Free;
end;
How to set the style of a shape before drawing?
- When you draw a shape,maybe,you'll draw some same style shape.you can set the base style of TMyCAD setting before draw it.you can set Brush,Pen,Font properties of tcad first,then when you draw a new shape,it will be effective.
- If you draw a line style,you can set ArrowAngle,ArrowLength,ArrowOffset,ArrowStyle properties besides above properties.
- Also,you can do it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.Pen.Color:=clGreen; MyCAD1.ArrowStyle:=ADouble; MyCAD1.ArrowOffset:=20; //Draw a line //... end;
How to draw a polygon?
- Set ShapeTool property as SpPolygon,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
var
p: array of TmyPoint;
begin
SetLength(P, 4);
P[0] := MyPoint(390, 11);
p[1] := MyPoint(380, 70);
p[2] := MyPoint(210, 10);
p[3] := MyPoint(110, 190);
if MyCAD1.GetShapeByName('PolygonShapeArray') = nil then
MyCAD1.AddShapeByCode(MyCAD1,spPolygon, 'PolygonShapeArray', p);
SetLength(P, 0);
end;
How to set draw style of link line?
- You can do it with TCAD's inspector.See LinkLineDrawStyle property,you can change draw style by it.
- Also,you can do it by code.see it.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.LinkLineDrawStyle:=lldsFree; end;
How to connect a link line to a link point of a existed TMyCombine?
- There are CmbShape (TMyCombine) and LinkShape (TMyLinkLine) on the TMyCAD, and they are not linked,and there are 3 link points in CmbShape (TMyCombine),we will link them by code.
procedure TMainFrm.Button1Click(Sender: TObject);
var
cmbShape,LinkShape:TMyShape;
begin
cmbShape:=MyCAD1.GetShapeByName('Shape1') ;
LinkShape:=MyCAD1.GetShapeByName('Shape0') ;
if linkshape <> nil then
begin
(LinkShape as TMyLinkline).CreateSrcLink(CmbShape.ShapeId,2);
(LinkShape as TMyLinkline).CreateDestLink(CmbShape.ShapeId,0);
end;
end;
- it is also effect for TMyLinkPoint.
How to get start shape and end shape on a link line shape linked?
procedure TMainFrm.Button1Click(Sender: TObject);
var
StartShape,EndShape,ALinkLineShape:TMyShape;
begin
ALinkLineShape:=MyCAD1.GetSelectedShape;
StartShape:=TMyLinkLine(ALinkLineShape).GetStartShape;
if StartShape= nil then
ShowMessage('No start shape linked!')
else
ShowMessage(StartShape.Name);
EndShape:=TMyLinkLine(ALinkLineShape).GetEndShape;
if EndShape= nil then
ShowMessage('No end shape linked!')
else
ShowMessage(EndShape.Name);
end;
How to create a link line?
procedure TMainFrm.Button1Click(Sender: TObject);
var
SrcShape,DestShape:TMyShape;
begin
//...
if MyCAD1.GetShapeByName('LinkLineShape')=nil then
begin
if MyCAD1.CreateLink('LinkLineShape',SrcShape,0,DestShape,1)>-1 then
ShowMessage('Created Success!')
else
ShowMEssage('Created failed!');
end
else
ShowMessage('LinkLine Shape has been created!');
end;
How to hide a hot link point?
- In inspector,set ShowHotLink property value as False.
- Also,set value by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin MyCAD1.ShowHotLink:=false; //... end;
How to set font of a shape with a standard font dialog?
procedure TMainFrm.Button5Click(Sender: TObject); begin FontDialog1.Font := MyCAD1.GetSelectedShape.Font as TFont; if FontDialog1.Execute then MyCAD1.GetSelectedShape.Font.Assign(FontDialog1.Font); end;
How to set align of text
- If you want to align a text,you can find some properties.HAlignment property can set horizontal alignment.VAlignment property can set vertical alignment.WordWrap property
- Set WordWrap to true to allow the text to display multiple line of text.When WordWrap is true,text that is too wide for the outer rectanger control wraps at the right margin and continues in additional lines.Set WordWrap to false to limit the label to a single line. When WordWrap is false, text that is too wide for the uter rectanger appears outside.
- Also,you can set value by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin if (MyCAD1.GetSelectedShape<>nil) and (MyCAD1.GetSelectedShape is TMyText) then begin TMyText(MyCAD1.GetSelectedShape).HAlignment:=taCenter; TMyText(MyCAD1.GetSelectedShape).VAlignment:=vaTop; TMyText(MyCAD1.GetSelectedShape).WordWrap:=true; end; end;
How to set align of text?
- If you want to align a text,you can find some properties.HAlignment property can set horizontal alignment.VAlignment property can set vertical alignment.WordWrap property
- Set WordWrap to true to allow the text to display multiple line of text.When WordWrap is true,text that is too wide for the outer rectanger control wraps at the right margin and continues in additional lines.Set WordWrap to false to limit the label to a single line. When WordWrap is false, text that is too wide for the uter rectanger appears outside.
- Also,you can set value by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin if (MyCAD1.GetSelectedShape<>nil) and (MyCAD1.GetSelectedShape is TMyText) then begin TMyText(MyCAD1.GetSelectedShape).HAlignment:=taCenter; TMyText(MyCAD1.GetSelectedShape).VAlignment:=vaTop; TMyText(MyCAD1.GetSelectedShape).WordWrap:=true; end; end;
How to show border around text?
- If you want to show a border around text,you can set IsBorder property as True.
- Also,you can set value by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject); begin if (MyCAD1.GetSelectedShape<>nil) and (MyCAD1.GetSelectedShape is TMyText) then TMyText(MyCAD1.GetSelectedShape).IsBorder:=true; end;
How to add a text?
- Set ShapeTool property as SpText,then you can draw it by mouse.
- Also,you can draw it by code.
- Code example:
procedure TMainFrm.Button1Click(Sender: TObject);
var
AText:TMyText;
SText:TStringList;
begin
if MyCAD1.GetShapeByName('TextShape') = nil then
MyCAD1.AddShapeByCode(MyCAD1,SpText, 'TextShape', [MyPoint(100, 100),
MyPoint(250, 100),MyPoint(250, 150), MyPoint(100, 150)], 30*pi/180, );
AText:=TMyText(MyCAD1.GetShapeByName('TextShape'));
SText:=TStringList.Create;
SText.Add('TCAD Text');
AText.Lines.Assign(SText);
SText.Free;
end;
- Note:TCAD xp.a , TMyText support multi-lines text,new property is lines, but you still can use Info property.
How to select all shapes in a layer?
procedure TMainFrm.Button3Click(Sender: TObject); begin SetLength(MyCAD1.WorkingShapes,Length(MyCAD1.GetShapesByLayerId(0))); MyCAD1.WorkingShapes := MyCAD1.GetShapesByLayerId(0); end;
How to zoom canvas by mouse wheel?
procedure TMainFrm.ScrollBox1MouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
var
preZoom:Double;
s1:String;
begin
preZoom:=MyCAD1.Zoom;
s1:=format('%.2f',[preZoom]);
if s1='0.10' then
begin
if WheelDelta > 0 then
MyCAD1.Zoom := MyCAD1.Zoom + WheelDelta / 12000;
end;
if s1='10.01'then
begin
if WheelDelta < 0 then
MyCAD1.Zoom := MyCAD1.Zoom + WheelDelta / 12000;
end;
if (preZoom > 0.10) and (preZoom < 10.00) then
begin
MyCAD1.Zoom := MyCAD1.Zoom + WheelDelta / 12000;
end;
CenterCAD();
end;
Working with Inspector
How to use of inspector?
- First,drag the component of TComponentComboBox and TComponentInspector to a form.
- Then,set ComponentCombox1's Root property as the instance of MyCAD1 and ComponentCombox1's ComponentInspector property as the instance of ComponentInspector1.
- Last, To monitor the shape that after you "adding a shape" or "selecting a shape" , please add code like this:
procedure TMainFrm.MyCAD1ShapeAdded( var AShape: TMyShape; ShapeCount: Integer); begin ComponentComboBox1.Instance:=AShape; ComponentInspector1.Instance:=ComponentComboBox1.Instance; end;
How to translate the inspector property name to your country language?
- You can find the event named OnGetName in TComponentInspector component,then add code to translate the property name to your country language,code like this:
procedure TCADInspFrm.ComponentInspector1GetName(Sender: TObject; TheIndex: Integer; var Value: String); begin //To change name to MyName if ComponentInspector1.Properties[TheIndex].Name='Name' then Value:='MyName'; end;
How to hide property in inspector?
- You can find the event named OnFilter in TComponentInspector component,then add code to hide some properties,code like this:
procedure TInspFrm.ComponentInspector1Filter(Sender: TObject; Prop: TProperty; var Result: Boolean); begin //hide the some properties in Inspector if UpperCase(Prop.Name)='NAME' then Result:=false; end;
Working with Ruler
How to use ruler?
- First,drag the component of TRsRulerCorner and two TRsRulers to a form.
- Then,set RsRuler1's Direction property as rdTop and HairLine property as True,RsRuler2's Direction property as rdLeft and HairLine property as True.
- Last,Add code to realize when move mouse on a form then the ruler works.
- Code example:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin RsRuler1.HairLinePos:=X; RsRuler2.HairLinePos:=Y; end;
- Note:you can use TPanel component to locate the position.

