27. september 2000 - 18:33Der er
4 kommentarer og 1 løsning
Styring af andet kørende program
Hejsa, her er et svært spørgsmål.
Jeg vil gerne kunne programmere mig til flg:
At kunne hente noget grafik fra et andets programs vindue på pos X,Y - X1,Y1 afhængig af om dette indeholder noget el. nogetandet. el. nogettredje, skal mit program trykke på bestemte steder i det andet vindue.
Hvis du ved hvor det er i relation til desktoppen desktoppen, kan du bruge flg. class: <SNIP> TDxDesktopCanvas = class(TCanvas) private dcDesktop : hDC; // Use \"handle\" to access the desktop\'s canvas public Constructor Create; Destructor Destroy; override; end;
:) Hvis jeg har forstået det ret, kan jeg nogenlunde tage koden ind i et nyt program. Hvorefter jeg har TDxDesktopCanvas som en TCanvas, hvorså jeg kan bruge copyrect til at få grafik ind. Men er det fra det vindue der ligger oven på desktop der bliver kopieret fra, eller er desktop under vinduet det handler om ?
Linien: \"ScreenCap.Canvas.CopyRect(DeskRect, DeskCanvas, DeskRect);\" fortæller netop hvor fra/til der skal kopieres. Hvis du kigger i Delphi\'s hjælp kan du se at: <SNIP> Copies part of an image from another canvas into the canvas.
Use CopyRect to transfer part of the image on another canvas to the image of the TCanvas object. Dest specifies the rectangle on the canvas where the source image will be copied. The Canvas parameter specifies the canvas with the source image. Source specifies a rectangle bounding the portion of the source canvas that will be copied.
The portion of the source canvas is copied using the mode specified by CopyMode. </SNIP>
Det vil sige at det første parameter er \"hvorfra\" (altså din X1,Y1,X2,Y2). Du kan definere en variabel ekstra som du eksempelvis kalder (Var DestRect : TRect). Denne skal du så tildele dine X1,Y2,X2,Y2 værdier, hvilket du gør med:
DestRect := Rect(10,10,100,100);
og den \"færdige linie\" skal således så sådan her ud:
Flg. eksempel er fra Delphi\'s hjælp: <SNIP> he following code illustrates the differences between CopyRect and BrushCopy. The bitmap graphic ‘TARTAN.BMP’ is loaded into Bitmap and displayed on the Canvas of Form1. BrushCopy replaces the color black in the graphic with the brush of the canvas, while CopyRect leaves the colors intact.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.