(Solved) selected area with rectangle lazarus / 39-Graphics ---------------------------------------------------------------------- xinyiman · 2012-07-23 14:09 Who tells me how do I create a rectangle (with dotted lines) on a TImage when I select a part of? And how do I determine the coordinates of the selected area? ---------------------------------------------------------------------- KpjComp · 2012-07-23 14:17 So that you don't modify the TImage itself, what you can do is place a TPaintBox over the top of the TImage.  And then draw you dotted lines on the TPaintBox OnPaint event. To make it so the user can move/size the rectangle you could place even more TPaintBox's or TShape's for the Handles, and the use the following technique to do the moving. -> http://www.lazarus.freepascal.org/index.php?topic=17356.0 ---------------------------------------------------------------------- xinyiman · 2012-07-27 08:23 Ok, doing a bit of evidence I think I have figured out how. I only have a doubt! How do I clean the TPaintBox riseleziono when another part of the object?! So how can I delete the rectangles already created in TPaintBox?! ---------------------------------------------------------------------- xinyiman · 2012-07-27 09:08 I understand that you have to use the property invalidated. Except that when I use it and then drawing a rectangle in succession I do not keep! I delete it. How can I do?! ---------------------------------------------------------------------- xinyiman · 2012-07-27 09:30 I solved in this mode           PaintBox1.Invalidate;           PaintBox1.Refresh;           PaintBox1.Canvas.Rectangle(x_SelIniz,y_SelIniz,x,y);