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 Object Position

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
kbrad1 Posted - Sep 04 2015 : 18:58:33
Hi,

When using the mouse left-click to place an object, the default behavior is to position the upper left-hand corner of the object at the mouse x,y coords. Is there a property or way to have the object centered at the mouse x,y coords.

Thanks.

kbrad
2   L A T E S T    R E P L I E S    (Newest First)
kbrad1 Posted - Sep 06 2015 : 11:14:53
Truly appreciated!

kbrad
w2m Posted - Sep 05 2015 : 16:11:38
Use the ImageEnVect1NewObject event:
procedure TForm1.ImageEnVect1NewObject(Sender: TObject; hobj: Integer);
{ Center any new object in the center of TImageEnVect.  If more than one object
 is added and the first object is not moved, the second object will be placed over
 the first object }
begin
  ImageEnVect1.ObjLeft[hobj] := ImageEnVect1.ClientWidth div 2;
  ImageEnVect1.ObjTop[hobj] := ImageEnVect1.ClientHeight div 2;
end;

procedure TForm1.ImageEnVect1NewObject(Sender: TObject; hobj: Integer);
{ Center any new object near the center of TImageEnVect.  If more than one object
  is added, subsequent objects will be offset for the previous so that all objects
  are near the center but are slightly offset }
var
  iObjectCount: Integer;
begin
  iObjectCount := ImageEnVect1.ObjectsCount;
  ImageEnVect1.ObjLeft[hobj] := (ImageEnVect1.ClientWidth div 2) + (iObjectCount * 5);
  ImageEnVect1.ObjTop[hobj] := ImageEnVect1.ClientHeight div 2 + (iObjectCount * 5);
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development