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
 ImageEnVect.LayersMove does not work

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
Kostas Posted - Feb 26 2012 : 10:49:10
Greetings All,

here is a smal example to draw two vectorial boxes
The question is, how do I get the first box to the top?

procedure TForm1.Button1Click(Sender: TObject);
var LayerUp, LayerDown, h1, h2:integer;
    ObjectRect:TRect;
begin
  ImageEnVect1.LayersSync := true;

  //Create a blue box
  LayerDown := ImageEnVect1.LayersAdd;

  h1 := ImageEnVect1.AddNewObject;
  ObjectRect := Rect(10,10,110,110);

  ImageEnVect1.ObjKind[h1] := iekBOX;
  ImageEnVect1.SetObjRect(h1, ObjectRect);
  ImageEnVect1.ObjPenStyle[h1] := psClear;
  ImageEnVect1.ObjBrushStyle[h1] := bsSolid;
  ImageEnVect1.ObjGraphicRender := true;
  ImageEnVect1.ObjTransparency[h1] := 255;
  ImageEnVect1.ObjBrushColor[h1] := clBlue;
  ImageEnVect1.ObjStyle[h1]:=[ievsVisible];
  ImageEnVect1.ObjGripPen.Style := psClear;
  ImageEnVect1.ObjGripBrush.Style := bsclear;


  //Create a red box over the blue box
  LayerUp := ImageEnVect1.LayersAdd;

  h2 := ImageEnVect1.AddNewObject;
  ObjectRect := Rect(20,20,120,120);

  ImageEnVect1.ObjKind[h2] := iekBOX;
  ImageEnVect1.SetObjRect(h2, ObjectRect);
  ImageEnVect1.ObjPenStyle[h2] := psClear;
  ImageEnVect1.ObjBrushStyle[h2] := bsSolid;
  ImageEnVect1.ObjGraphicRender := true;
  ImageEnVect1.ObjTransparency[h2] := 255;
  ImageEnVect1.ObjBrushColor[h2] := clRed;
  ImageEnVect1.ObjStyle[h2]:=[ievsVisible];
  ImageEnVect1.ObjGripPen.Style := psClear;
  ImageEnVect1.ObjGripBrush.Style := bsclear;


  //to try invisible the LayerUp, but does not work
  ImageEnVect1.Layers[ LayerUp ].Visible := false;


  //to try brind to front the blue box, but does not work
  ImageEnVect1.LayersMove(LayerUp, LayerDown);



end;


What am I doing wrong?

Regards,
Kostas
2   L A T E S T    R E P L I E S    (Newest First)
Kostas Posted - Feb 26 2012 : 13:02:41
many thanks fabrizio,
SetObjFrontOf works fine.

Regards,
Kostas
fab Posted - Feb 26 2012 : 11:42:54
Hello,
please don't mix layers and vectorial objects if it isn't necessary (let me know if you actually need it).
Also never set LayersSync=true (repeat, if you don't actually it).

Try this code:

procedure TForm1.Button1Click(Sender: TObject);
var h1, h2:integer;
    ObjectRect:TRect;
begin
  //Create a blue box
  h1 := ImageEnVect1.AddNewObject;
  ObjectRect := Rect(10,10,110,110);

  ImageEnVect1.ObjKind[h1] := iekBOX;
  ImageEnVect1.SetObjRect(h1, ObjectRect);
  ImageEnVect1.ObjPenStyle[h1] := psClear;
  ImageEnVect1.ObjBrushStyle[h1] := bsSolid;
  ImageEnVect1.ObjGraphicRender := true;
  ImageEnVect1.ObjTransparency[h1] := 255;
  ImageEnVect1.ObjBrushColor[h1] := clBlue;
  ImageEnVect1.ObjStyle[h1]:=[ievsVisible];
  ImageEnVect1.ObjGripPen.Style := psClear;
  ImageEnVect1.ObjGripBrush.Style := bsclear;


  //Create a red box over the blue box
  h2 := ImageEnVect1.AddNewObject;
  ObjectRect := Rect(20,20,120,120);

  ImageEnVect1.ObjKind[h2] := iekBOX;
  ImageEnVect1.SetObjRect(h2, ObjectRect);
  ImageEnVect1.ObjPenStyle[h2] := psClear;
  ImageEnVect1.ObjBrushStyle[h2] := bsSolid;
  ImageEnVect1.ObjGraphicRender := true;
  ImageEnVect1.ObjTransparency[h2] := 255;
  ImageEnVect1.ObjBrushColor[h2] := clRed;
  ImageEnVect1.ObjStyle[h2]:=[ievsVisible];
  ImageEnVect1.ObjGripPen.Style := psClear;
  ImageEnVect1.ObjGripBrush.Style := bsclear;


  // to hide h1 object
  ImageEnVect1.ObjStyle[h1] := [];

  ...or...

  // to bring h1 over h2
  ImageEnVect1.SetObjFrontOf(h1, h2);

end;


If you need to anchor objects and layers use ObjLayer[] property.