[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

Center image on an image

Need a example how to place a small image centered on a larger image. Thanks for the help.
0
2meathome
Asked:
2meathome
  • 2
1 Solution
 
ThommyCommented:
Image1 = larger image
Image2 = smaller image

Image2.Left:=Image1.Left+(image1.Width-Image2.Width) div 2;
Image2.Top :=Image1.Top+(image1.Height-Image2.Height) div 2;

Open in new window

0
 
Geert GruwezOracle dbaCommented:
you'll need
Image2.BringToFront to place it on top of image1
0
 
ThommyCommented:
As a procedure...

procedure CenterImage(ImageLarge,ImageSmall:TImage);
begin
  ImageSmall.Left:=ImageLarge.Left+(imageLarge.Width-ImageSmall.Width) div 2;
  ImageSmall.Top :=ImageLarge.Top+(imageLarge.Height-ImageSmall.Height) div 2;
  ImageSmall.BringToFront;
end

Open in new window

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now