Einzelnen Beitrag anzeigen

juniorA

Registriert seit: 14. Sep 2011
112 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#8

AW: Position Elemente in TImage ???

  Alt 18. Sep 2020, 15:01
aktuell bin ich bei folgender Variante
Delphi-Quellcode:
unit zf;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
  FMX.Controls.Presentation, FMX.Objects;

type
  Tzeichnung = class(TForm)
    Image1 : TImage;
    Panel1 : TPanel;
    Button1 : TButton;
    procedure Button1Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  zeichnung: Tzeichnung;

implementation

{$R *.fmx}

procedure Tzeichnung.Button1Click(Sender: TObject);
var MyBitmap: TBitmap;
    MyRect : TRectF;
begin
  MyBitmap := TBitmap.Create(0, 0);
  try
    MyRect.Create(50, 30, 150, 200); // A record on the stack, does not Free
    MyBitmap.Assign(Image1.Bitmap);
    MyBitmap.Canvas.BeginScene;
    MyBitmap.Canvas.Stroke.Kind := TBrushKind.Solid;
    MyBitmap.Canvas.Stroke.Color := TAlphaColors.Black;
    MyBitmap.Canvas.Stroke.Thickness := 4;
    MyBitmap.Canvas.DrawRect(MyRect, 20, 20, AllCorners, 1.0);
    MyBitmap.Canvas.EndScene;

    // Display the result
    Image1.Bitmap := MyBitmap;
  finally
    MyBitmap.Free;
  end;
 end;
end.
leider endet die mit einer Fehlermeldung "Kein Eigentümer der Obejektsperre gefunden"
  Mit Zitat antworten Zitat