How to draw on the entire area of a resized TImage in Delphi? -
I've narrowed down a problem on which I painted in Delphi 2009 at TImage.Canvas
The reproducible case has been given:
given: a form, a TImage
, TLabel
and TButton
on it . TImage
is anchored on all four edges so changing the size of the form will change the size of the TImage
. What I want to be able to do is attract me to the maximum area of available Image1
after resizing, in case of my trial, I have the button's OnClick
Handler is:
Process TForm1.Button1Click (Sender: Tubaxide); Start Label1.Caption: = IntToStr (Image1.Width) + 'x' + IntToStr (Image1.Height); Image1.Canvas.Pen.Color: = 0; Image 1 Canvas. Reference (0,0, Image 1. With, Image 1. Height); End;
You will see that if the form is resized, theImage1.Width
and.ighted
varies in expected form, yet the rectangle drawn The size of the original size is large , it would be incomplete, should only be painted on the area which was previously.How do I use the whole size area?
In my basic problem I played with the code
Image1.Stretch , which allows me to use more area on resizing but as a result my pictures are distorted Will be done (not wanted). If I also use Image1.Proportional
, then it is better, but I still can not use the full area availableImage1.AutoSize
anything useful to me not doing.Any help appreciated.
Add an honors-event to your form:
Process TForm1 .form resize (sender: tubage); Start image 1. picture. Bitmap With: = image 1. Image 1 picture. Bitmap Height: = Picture 1. height; End;
In addition, if you are using components to drag images instead of displaying images from the image image, consider using the Tepentbox instead of TIMAG.
Comments
Post a Comment