TCanvas (TPaintbox or any component with Canvas) - resizing lazarus / 8-Other ---------------------------------------------------------------------- guest · 2004-09-02 17:52 When I resize eg. PaintBox or any other component with Canvas, Canvas boundaries do not change at all. Property "ClipRect" remains unchanged (I can paint only in old area) and I cannot change it manually... I tried to change "Region" property but with no effect to boundaries. How can I solve this problem??? thanks for advices[/b] ---------------------------------------------------------------------- nhaider · 2004-09-03 06:57 Did you change the width and height properties?  E.g., Code: [Select]paintbox1.width := form1.width - 20; paintbox1. height := form1.height - 20; Or, if your paintbox sits in a scrollbox, then you might adjust the scrollbox.width and .height to your form, and the paintbox to your scrollbox. This should work without any problem and is best put into the TForm1.FormResize procedure which is called upon each resize event. I don't know about "ClipRect" and "Region". In general, it seems that many TCanvas-related items have not yet been implemented: so far, I could not set the color of a canvas (it is always grey), I could not set the pen.mode property (which would be _very_ important for any interactive graphics application), nor could I get getpixel/setpixel working. Seems like we have to patient.... NH ---------------------------------------------------------------------- guest · 2004-09-03 08:16 Of course that I changed eg. paintbox width or height!!!!!!! But Canvas DOES NOT REACT!  It Does not change its bounds AT ALL! The Problem is: When I resize e.g paintbox or anything else I can paint only in OLD Area. ClipRect remains unchanged and I cant change it - Bounds of Canvas stay unchanged! Thats the problem (or BUG) ---------------------------------------------------------------------- nhaider · 2004-09-03 09:01 Keep cool. Which version of Lazarus are you using? I have 0.9.2-beta on Linux (SuSE 9.1) and here it works. But I don't use anything like ClipRect, I draw on the entire canvas of a paintbox in a scrollbox which gets resized with my form. BTW, can you successfully set the color property or the pen.mode of your canvas? I am still having no luck with these. NH ---------------------------------------------------------------------- guest · 2004-09-03 11:53 I have got 0.9.2-beta on Mandrake 9.2. All previous versions (of lazarus ) had the same problem. You resize only Scrollbox or also Paintbox??? I know nothing about pen.mode. I havent tried it yet. Now I am at school and I dont have Lazarus here... It seems that Canvas has some problems with resizing - ClipRect (Rectangle where paint is visible). Try Delphi - Cliprect changes there when resizing... ---------------------------------------------------------------------- guest · 2004-09-06 16:35 I investigated this problem a bit more: I can resize Paintbox (or anything with Canvas) and Canvas resizes. But when I paint even a single line or pixel I cannot resize Canvas any more - component resizes but Canvas stays in its old boundaries! It is strange and seems to be a bug. Where should I report bugs??? ...to potěší ---------------------------------------------------------------------- Vincent Snijders · 2004-09-06 18:40 You can report bugs in the bug tracker (see menu on the left): http:// www.lazarus.freepascal.org/modules.php?op=modload&name=BugTracker&file =index ---------------------------------------------------------------------- nhaider · 2004-09-07 11:08 After playing around a little bit, I found that the ClipRect is set correctly for all painting operations which are done in the procedure which is called by the OnPaint event (e.g., Form1.Paintbox1paint). For all other drawing (for instance, my custom selection tool), I notice the same strange behavior like you. Seems to be a bug, indeed. Another strange thing: when I use the canvas.pixels[X,Y] property to get the color of a pixel, I must use the negative value of X, otherwise I get an access violation error.