[DUG]: Canvas and cliprect....

Stacey Verner stacey at cjntech.co.nz
Wed Jun 29 09:26:17 NZST 2005


You should be working with the TBitmap associated with the image.

Use something like TBitpmap(image.picture.graphic).Canvas;

Stacey

> -----Original Message-----
> From: delphi-bounces at ns3.123.co.nz 
> [mailto:delphi-bounces at ns3.123.co.nz] On Behalf Of Chris Veale
> Sent: Wednesday, 29 June 2005 9:01
> To: delphi at delphi.org.nz
> Subject: [DUG]: Canvas and cliprect....
> 
> 
> Hi,
> 
> I have an image that I want to display the colour of the 
> pixel under the cursor when the left mouse button is clicked.
> 
> I have the following section of code that does it (doesnt 
> sound difficult does it.)...
> 
> ====================
> procedure TForm1.imageMouseMove(Sender: TObject; Shift: 
> TShiftState; X,
>   Y: Integer);
> var
>   colour:TColor;
> begin
>   colour := Form1.image.Canvas.Pixels[X,Y]; ====================
> 
> However I always get -1 returned as the cliprect for the 
> image canvas is always [0,0],[1,1]
> 
> Looking at the help and trial and error I cannot set the 
> cliprect parameters, so my question is how do these values 
> get set at runtime, and also how can I actually get the 
> colour being recognised?
> 
> Cheers
> 
> Chris
> 
> ______________________________________________________
> 
> The contents of this e-mail are privileged and/or 
> confidential to the named recipient and are not to be used by 
> any other person and/or organisation. If you have received 
> this e-mail in error, please notify the sender and delete all 
> material pertaining to this e-mail.
> ______________________________________________________
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
> 



More information about the Delphi mailing list