ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Draw multiple selection rectangle in TImageEnView

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
quillt Posted - Feb 08 2018 : 05:58:06
I want to draw multiple selection rectangles (by mouse) in a TImageEnView as shown in the picture. The rectangles will have numbers in the order in which they are created and each of the rectangles should be resizeable to adjust its area and deletable also.

2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 11 2018 : 21:34:45
Alternatively, use a TIEShapeLayer with the OnDrawLayer or new OnBeforeDrawLayer event to draw the number.


// Display the index over the layer
procedure Tfmain.ImageEnView1DrawLayer(Sender: TObject; dest: TIEBitmap; LayerIndex: Integer);
var
  lyrRect, aRect: TRect;
begin
  lyrRect := ImageEnView1.Layers[ LayerIndex ].ClientAreaBox;
  aRect := Rect( lyrRect.Left + 10, lyrRect.Top + 10, lyrRect.Left + 40, lyrRect.Top + 40 );
  With dest.Canvas do
  begin
    // Simple example: Would be better to center text in filled rect
    Brush.Color := clBlue;
    FillRect( aRect );

    Font.Color  := clWhite;
    Font.Height := 12;
    Font.Style  := [fsBold];

    TextRect( aRect, lyrRect.Left + 20, lyrRect.Top + 20, IntToStr( LayerIndex ));
  end;
end;




Nigel
Xequte Software
www.imageen.com
xequte Posted - Feb 08 2018 : 20:11:33
Hi

Just use a TIEShapeLayer (optionally with a TIETextLayer for the numbers).

Please try this demo:

Demos\LayersEditing\Layers_AllTypes\Layers.dpr



Nigel
Xequte Software
www.imageen.com