Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Copyrect geht nicht (https://www.delphipraxis.net/35034-copyrect-geht-nicht.html)

MasterC 1. Dez 2004 17:50


Copyrect geht nicht
 
Hi,

warum geht das nicht? Img2 bleibt leer:

Delphi-Quellcode:
img := TBitmap.create;
img.loadfromfile('c:\xmas.bmp');
img2 := TBitmap.create;
myrect := rect(0, 0, 80, 80);
myrect2 := rect(0, 0, 80, 80);
img2.canvas.copyrect(myrect, img.Canvas, myrect2);
mybutton.Glyph := img2;
img.Free;
Ich will einen Teil von img in img2 kopieren.

MFG Chris.

Muetze1 1. Dez 2004 18:35

Re: Copyrect geht nicht
 
Moin!

Ganz einfach, weil img2 keine Höhe und Weite hat - und daher 0x0 Pixel gross ist. Du musst die Grösse des Bitmaps vorher festlegen, CopyRect() oder andere Funktionen kümmern sich nicht darum...

Delphi-Quellcode:
img := TBitmap.create;
img.loadfromfile('c:\xmas.bmp');
img2 := TBitmap.create;
img2.Width := 81;
img2.Height := 81;
myrect := rect(0, 0, 80, 80);
myrect2 := rect(0, 0, 80, 80);
img2.canvas.copyrect(myrect, img.Canvas, myrect2);
mybutton.Glyph := img2;
img.Free;
MfG
Muetze1


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:40 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz