[DUG]: Canvas and cliprect....
Sabu Hariharan
Sabu.Hariharan at isoftplc.com
Wed Jun 29 19:12:04 NZST 2005
Hi Chris,
Your code is right but it will work with valid bitmaps only.
If you try the same with Jpeg images, it will not work.
Regards,
Sabu
iSOFT, India.
Original message :
Message: 3
**********************************
THIS E-MAIL IS CONFIDENTIAL. If you have received this transmission in error please notify iSOFT Group plc immediately either by replying to this e-mail or by telephone on +44 (0) 870 050 8901 and then delete this e-mail. iSOFT Group plc has taken all reasonable precautions to protect against infection by software viruses, but does not accept any responsibility for any damage which you sustain as a result of software viruses. You should therefore scan attachments (if any) prior to opening them.
***********************************
Date: Wed, 29 Jun 2005 09:00:51 +1200
From: "Chris Veale" <CVeale at hortresearch.co.nz>
Subject: [DUG]: Canvas and cliprect....
To: <delphi at delphi.org.nz>
Message-ID: <s2c263cd.064 at hra2.marc.hort.cri.nz>
Content-Type: text/plain; charset=US-ASCII
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
**********************************************************************
More information about the Delphi
mailing list