我正在为IOS的DelphiXE2 firemonkey构建一个应用程序。如果我在Xcode IPAD模拟器中测试了mac,我看到了按钮。但是当我点击按钮时,没有可见的线条。为什么呢?
代码:(在Form a按钮和图像上)
unit Unit3;
interface
uses
SysUtils, Types, UITypes, Classes, Variants, FMX_Types, FMX_Controls, FMX_Forms,
FMX_Dialogs, FMX_Objects;
type
TForm3 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form3: TForm3;
implementation
{$R *.lfm}
procedure TForm3.Button1Click(Sender: TObject);
var pt0,pt1 : TPointF;
begin
pt0.Create(0,0);
pt1.Create(200,200);
with Image1.Bitmap do begin
Canvas.Stroke.Color := $ffff0000 ; // Red
Canvas.BeginScene;
Canvas.DrawLine(pt0,pt1,1);
BitmapChanged; // without this, no output
Canvas.EndScene;
end;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
Image1.Bitmap := TBitmap.Create(200,200);
end;
end.
答案 0 :(得分:1)
我认为应该是:
pt0 := TPointF.Create(0, 0);
答案 1 :(得分:1)
试试这个
pt0.X:=X;
pt0.Y:=Y;
pt1.X:=X+4;
pt1.Y:=Y+4;
with Image1.Bitmap do begin
Canvas.Stroke.Color := $ffff0000 ; // Red
Canvas.Stroke.Kind := TBrushKind.bkSolid;
Canvas.StrokeThickness:= 10;
Canvas.BeginScene;
Canvas.DrawLine(pt0,pt1,100);
Canvas.EndScene;
end;