Einzelnen Beitrag anzeigen

Benutzerbild von jaenicke
jaenicke

Registriert seit: 10. Jun 2003
Ort: Berlin
9.332 Beiträge
 
Delphi 11 Alexandria
 
#42

AW: Bitmap.Canvas -> Form.Canvas ... nix zu sehen

  Alt 12. Jul 2018, 12:33
Dazu gibt es auch gerade einen aktuellen Blogeintrag.
https://wiert.me/2018/07/11/dont-acc...-to-demo-that/
Dort wird auch ein Beispiel gezeigt, das dem Thema hier sehr ähnlich ist:
Zitat:
Found a simple one.

Create a new VCL program. Drop a TImage on the form. Insert this code:

Delphi-Quellcode:
procedure TForm47.FormCreate(Sender: TObject);
begin
  TThread.CreateAnonymousThread(
  procedure
  begin
    PaintToImage(Image1);
  end).Start;
end;

procedure TForm47.PaintToImage(image: TImage);
begin
  while true do begin
    Image1.Picture.Bitmap := TBitmap.Create;
    Image1.Picture.Bitmap.Free;
  end;
end;
Run in debugger. Instant access violation in the WMPaint handler of the main thread.
Sebastian Jänicke
Alle eigenen Projekte sind eingestellt, ebenso meine Homepage, Downloadlinks usw. im Forum bleiben aktiv!
  Mit Zitat antworten Zitat