Forum > Other

TCanvas (TPaintbox or any component with Canvas) - resizing

(1/2) > >>

guest:
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:
Did you change the width and height properties?  E.g.,

--- Code: ---paintbox1.width := form1.width - 20;
paintbox1. height := form1.height - 20;

--- End code ---

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:
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:
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:
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...

Navigation

[0] Message Index

[#] Next page

Go to full version