Board index » cppbuilder » Center an image in a form

Center an image in a form

I have my my main form containing a Panel, a status line et such over things, I'd like to center my Image into this form regarding
the position of all other components.

How can I do this.
I try to get the dimensions of the drawing area but not succeeded.

A++

 

Re:Center an image in a form


I'm not quite sure what exactly you want, but maybe this will set you offin
the right direction:
    Image->Left = (Form->Width / 2) - (Image->Width / 2);
    Image->Top = (Form->Height / 2) - (Image->Height / 2);

If you are using the Panel to show the image then Image->Top and so on would
be substituted with Panel->Top and so on.

Good luck

Bj?rn Jonsson

Xavier MAILLARD <maill...@leri.univ-reims.fr> skrev i
diskussionsgruppsmeddelandet:392901d1@dnews...

Quote

> I have my my main form containing a Panel, a status line et such over

things, I'd like to center my Image into this form regarding
Quote
> the position of all other components.

> How can I do this.
> I try to get the dimensions of the drawing area but not succeeded.

> A++

Re:Center an image in a form


TRect Rect = Form1->BoundsRect;
Image1->Canv->Left = ((Rect.Right - Rect.Left)- Image1->Canv->Width)/2
+
Rect.Left;
Image1->Canv->Top = ((Rect.Bottom - Rect.Top)- Image1->Canv->Height)/2
+
Rect.Top;      

Gaetan SIRY
http://www.cbcsolutions.net
Developers of the most complete Video Programming Solution for Window:
XVideo

On 22 May 2000 02:45:53 -0800, "Xavier MAILLARD"

Quote
<maill...@leri.univ-reims.fr> wrote:

>I have my my main form containing a Panel, a status line et such over things, I'd like to center my Image into this form regarding
>the position of all other components.

>How can I do this.
>I try to get the dimensions of the drawing area but not succeeded.

>A++

Other Threads