kryslt / KControls

Free components for Delphi and Lazarus, this is the main repository maintained by the original author.
BSD 3-Clause Clear License
58 stars 32 forks source link

Print preview should set clipping to page area by default #3

Closed kryslt closed 9 years ago

kryslt commented 9 years ago

Original report by Marek Mauder (Bitbucket: galfar, GitHub: galfar).


It would be nice if print preview set clipping rect of the canvas to page area by default (before calling FControl.PaintPage in TKPrintPageSetup.PaintPageToPreview). This way controls that do not handle clipping correctly would not overflow like this: Capture.PNG

Currently it looks like it's a bug in preview viewer when in fact the user's control is to blame.

kryslt commented 9 years ago

Original comment by Tomas Krysl (Bitbucket: tomkrysl, GitHub: kryslt).


Well, I didn't make that by default because existing controls (KGrid, KHexEditor) use their own clipping region. Some descendant controls could be programmed without clipping region. Please use TranslateRectToDevice and SelectClipRect functions in your Paintpage method if you need clipping, as you did in Helpers.pas.