color of CANVAS.PIXELS[X,Y]

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
PERE-LAPERNE
Posts: 4
Joined: 04 Oct 2010, 19:56

color of CANVAS.PIXELS[X,Y]

Post by PERE-LAPERNE » 09 Oct 2015, 14:19

Alexander ,

I try to find the color of the pixel when i use the mouse down on the sgPaintBox ( property sgPaintBox: TsgDrawingNavigator read FsgPaintBox); ( Exemple Viewer )
The sgPaintBox is load with an AUTOCAD File

I Use this code :

procedure TFormViewPlan.imgFrameMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var vPt: TFPoint;
vUnits : String;
acolor : Tcolor ;
Begin
vPt := sgPaintBox.GetDrawingCoords(X, Y, vUnits);
aColor := sgPaintBox.Canvas.Pixels
[Round(Vpt.X),Round(sgPaintBox.Picture.Height-Vpt.Y)] ;
end;

The color is Black
Where is my problem ?

Thank you

Jacques

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: color of CANVAS.PIXELS[X,Y]

Post by support » 09 Oct 2015, 17:27

Hello Jacques,

The TsgDrawingNavigator.GetDrawingCoords function returns drawing coordinates in CAD units (TFPoint), not the pixel coordinates.


Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

PERE-LAPERNE
Posts: 4
Joined: 04 Oct 2010, 19:56

Re: color of CANVAS.PIXELS[X,Y]

Post by PERE-LAPERNE » 09 Oct 2015, 20:07

Thank you Mikhail ,

Ok ,
How can i found the color of the pixel when i use the mouse down on a TsgDrawingNavigator ?

thank you

Jacques

Post Reply