📄 main.pas
字号:
unit Main;interfaceuses SysUtils, Types, Classes, Variants, QGraphics, QControls, QForms, QDialogs, QStdCtrls, QExtCtrls;type TFrmMain = class(TForm) BtnShow: TButton; RadGrpClassType: TRadioGroup; procedure BtnShowClick(Sender: TObject); private { Private declarations } public { Public declarations } end;var FrmMain: TFrmMain;implementationuses Shapes;{$R *.xfm}procedure TFrmMain.BtnShowClick(Sender: TObject);var X, Y: Integer; str: string; Point, ToPoint: TPoint; Rect: TRect; Shape: TGeoShape;begin X := 10; Y := 10; case RadGrpClassType.ItemIndex of 0: // TGeoShape begin Shape := TGeoShape.Create(); // Error. Constructing instance of 'TGeoShape' containing abstract methods Shape.Draw( Canvas ); FreeAndNil( Shape ); end; 1: // TGeoPoint begin Point.X := 10; Point.Y := 50; Shape := TGeoPoint.Create(); TGeoPoint( Shape ).SetValue( Point ); Shape.Draw( Canvas ); FreeAndNil( Shape ); end; 2: // TGeoLine begin Point.X := 10; Point.Y := 50; ToPoint.X := 200; ToPoint.Y := 50; Shape := TGeoLine.Create(); TGeoLine( Shape ).SetValue( Point, ToPoint ); Shape.Draw( Canvas ); FreeAndNil( Shape ); end; 3: // TGeoRect begin Rect.Left := 10; Rect.Top := 10; Rect.Right := 200; Rect.Bottom := 200; Shape := TGeoRect.Create(); TGeoRect( Shape ).SetValue( Rect ); Shape.Draw( Canvas ); FreeAndNil( Shape ); end; end;end;end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -