I am working on a graph chart control and I want to define a clipping region to draw in it. I passed to the SelectClipRgn
function the coordinates to my clipping region relative to the Left
and Top
of the control. But it seems that it doesn’t select the right region. In fact the region became right only if I add the Left and Top position of the control in it’s parent (a form or a panel). What is happening ? Is this behavior normal ?
ClipRect:= Rect(MarginLeft, MarginTop, MarginLeft + GraphWidth, MarginTop + GraphHeight);
NewClipRgn:= CreateRectRgn(Left+ClipRect.Left, Top+ClipRect.Top, Left+ClipRect.Right, Top+ClipRect.Bottom);
SelectClipRgn(Canvas.Handle, NewClipRgn);