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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Want to show only one bounding box...
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
725 Posts

Posted - Aug 23 2018 :  00:12:51  Show Profile  Reply
Hello,

When a user selected multiple layers each layer show a bounding box.
Instead of this I want to show only one bounding box around all selected layers.

Is there any option by which we can tell IE to show a single bounding around selected layers?

How can we do this?

TIA


Yogi Yang

xequte

38222 Posts

Posted - Aug 23 2018 :  00:45:54  Show Profile  Reply
Hi Yogi


// Draw a box around all selected layers
// Note: To prevent the default selection box being drawn, create an empty OnDrawLayerBox event
procedure Tfmain.ImageEnView1DrawBackBuffer(Sender: TObject);
var
  cab: TRect;
  i, minX, minY, maxX, maxY : Integer;
begin
  minX := MAXINT;
  minY := MAXINT;
  maxX := 0;
  maxY := 0;

  for I := 0 to ImageEnView1.LayersCount - 1 do
    if ImageEnView1.Layers[ i ].Selected then
    begin
      cab := ImageEnView1.Layers[i].ClientAreaBox;
      minX := imin( minX, cab.Left );
      minY := imin( minY, cab.Top );
      maxX := imax( maxX, cab.Right );
      maxY := imax( maxY, cab.Bottom );
    end;

  // a green line
  if minX < MAXINT then
    with ImageEnView1.BackBuffer.Canvas do
    begin
      Pen.Style := psSolid;
      Pen.Width := 2;
      Pen.mode := pmCopy;
      Pen.Color := clGreen;
      Brush.Style := bsClear;
      Rectangle( minX - 1, minY - 1, maxX + 1, maxY + 1 );
    end;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

yogiyang

India
725 Posts

Posted - Aug 23 2018 :  01:21:04  Show Profile  Reply
Hello Nigel,

Thanks. I will try out your code.

TIA


Yogi Yang
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: