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
 ImageEnVect Object Position
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

kbrad1

USA
2 Posts

Posted - Sep 04 2015 :  18:58:33  Show Profile  Reply
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

w2m

USA
1990 Posts

Posted - Sep 05 2015 :  16:11:38  Show Profile  Reply
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
Go to Top of Page

kbrad1

USA
2 Posts

Posted - Sep 06 2015 :  11:14:53  Show Profile  Reply
Truly appreciated!

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