473,416 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Center an image on a tab page

Hi,

I have a tab control containing few tab pages. On each tab
pages, I put an image on the tab page's title bar (the
area on top of a tab page, ie where tooltip will appear).

If i put both an image and a text, they both will be
centered nicely. However, if I put only image without the
text, the image will position itself more to the left and
it is not centered.

Is it possible to have the image to be on the center?
Thank you.
regards,
Sean
Nov 16 '05 #1
7 4287
Sean,

There is a way to center the image. you have to add Paint Event of tab page
and get the graphics pointer

Graphics g = e.Graphics.
g.DrawImage(TestImage, new Rectangle(xDraw, yDraw, TestImageWidth,
TestImageHeight));

xDraw, and yDraw will get you the offset to center the image.

Shak.
"Sean" <an*******@discussions.microsoft.com> wrote in message
news:1d*****************************@phx.gbl...
Hi,

I have a tab control containing few tab pages. On each tab
pages, I put an image on the tab page's title bar (the
area on top of a tab page, ie where tooltip will appear).

If i put both an image and a text, they both will be
centered nicely. However, if I put only image without the
text, the image will position itself more to the left and
it is not centered.

Is it possible to have the image to be on the center?
Thank you.
regards,
Sean

Nov 16 '05 #2
Hi Shak,

Thank you for your reply.

It worked. Unfortunately, the yDraw actually starts from
the tabpage, but not the square area that usually contains
the text/title for the tabpage.

I want the image to be centered on the square where the
title/text shown.

Thank you.
regards,
Sean

-----Original Message-----
Sean,

There is a way to center the image. you have to add Paint Event of tab pageand get the graphics pointer

Graphics g = e.Graphics.
g.DrawImage(TestImage, new Rectangle(xDraw, yDraw, TestImageWidth,TestImageHeight));

xDraw, and yDraw will get you the offset to center the image.
Shak.
"Sean" <an*******@discussions.microsoft.com> wrote in messagenews:1d*****************************@phx.gbl...
Hi,

I have a tab control containing few tab pages. On each tab pages, I put an image on the tab page's title bar (the
area on top of a tab page, ie where tooltip will appear).
If i put both an image and a text, they both will be
centered nicely. However, if I put only image without the text, the image will position itself more to the left and it is not centered.

Is it possible to have the image to be on the center?
Thank you.
regards,
Sean

.

Nov 16 '05 #3
Ok...

Instead of adding paint event in tabpage, do the following

1.Set DrawMode Property of TabControl to OwnerDrawnFixed
2.add DrawItem event of Tabcontrol.
3. Get the graphics pointer and center the image.

Shak.
<an*******@discussions.microsoft.com> wrote in message
news:1d*****************************@phx.gbl...
Hi Shak,

Thank you for your reply.

It worked. Unfortunately, the yDraw actually starts from
the tabpage, but not the square area that usually contains
the text/title for the tabpage.

I want the image to be centered on the square where the
title/text shown.

Thank you.
regards,
Sean

-----Original Message-----
Sean,

There is a way to center the image. you have to add Paint

Event of tab page
and get the graphics pointer

Graphics g = e.Graphics.
g.DrawImage(TestImage, new Rectangle(xDraw, yDraw,

TestImageWidth,
TestImageHeight));

xDraw, and yDraw will get you the offset to center the

image.

Shak.
"Sean" <an*******@discussions.microsoft.com> wrote in

message
news:1d*****************************@phx.gbl...
Hi,

I have a tab control containing few tab pages. On each tab pages, I put an image on the tab page's title bar (the
area on top of a tab page, ie where tooltip will appear).
If i put both an image and a text, they both will be
centered nicely. However, if I put only image without the text, the image will position itself more to the left and it is not centered.

Is it possible to have the image to be on the center?
Thank you.
regards,
Sean

.

Nov 16 '05 #4
Hi Shak,

Thank you so much for your last post.
It works! However, there is a white line between the title
bar and the tabpage even for the selectedPage. This line
wasn't there when I had the DrawMode as Normal.

Is there a way to get rid of the white line between the
title bar and the tabpage for the selectedPage?

Thank you once again.
regards,
Sean
-----Original Message-----
Ok...

Instead of adding paint event in tabpage, do the following

1.Set DrawMode Property of TabControl to OwnerDrawnFixed
2.add DrawItem event of Tabcontrol.
3. Get the graphics pointer and center the image.

Shak.
<an*******@discussions.microsoft.com> wrote in message
news:1d*****************************@phx.gbl...
Hi Shak,

Thank you for your reply.

It worked. Unfortunately, the yDraw actually starts from
the tabpage, but not the square area that usually contains the text/title for the tabpage.

I want the image to be centered on the square where the
title/text shown.

Thank you.
regards,
Sean

>-----Original Message-----
>Sean,
>
>There is a way to center the image. you have to add Paint
Event of tab page
>and get the graphics pointer
>
>Graphics g = e.Graphics.
>g.DrawImage(TestImage, new Rectangle(xDraw, yDraw,

TestImageWidth,
>TestImageHeight));
>
>xDraw, and yDraw will get you the offset to center the

image.
>
>Shak.
>
>
>"Sean" <an*******@discussions.microsoft.com> wrote in

message
>news:1d*****************************@phx.gbl...
>
>> Hi,
>>
>> I have a tab control containing few tab pages. On
each tab
>> pages, I put an image on the tab page's title bar

(the >> area on top of a tab page, ie where tooltip will

appear).
>>
>> If i put both an image and a text, they both will be
>> centered nicely. However, if I put only image without

the
>> text, the image will position itself more to the left

and
>> it is not centered.
>>
>> Is it possible to have the image to be on the center?
>> Thank you.
>>
>>
>> regards,
>> Sean
>
>
>.
>

.

Nov 16 '05 #5
Hi Shak,

Thank you for your reply.

It worked. Unfortunately, the yDraw actually starts from
the tabpage, but not the square area that usually contains
the text/title for the tabpage.

I want the image to be centered on the square where the
title/text shown.

Thank you.
regards,
Sean

-----Original Message-----
Sean,

There is a way to center the image. you have to add Paint Event of tab pageand get the graphics pointer

Graphics g = e.Graphics.
g.DrawImage(TestImage, new Rectangle(xDraw, yDraw, TestImageWidth,TestImageHeight));

xDraw, and yDraw will get you the offset to center the image.
Shak.
"Sean" <an*******@discussions.microsoft.com> wrote in messagenews:1d*****************************@phx.gbl...
Hi,

I have a tab control containing few tab pages. On each tab pages, I put an image on the tab page's title bar (the
area on top of a tab page, ie where tooltip will appear).
If i put both an image and a text, they both will be
centered nicely. However, if I put only image without the text, the image will position itself more to the left and it is not centered.

Is it possible to have the image to be on the center?
Thank you.
regards,
Sean

.

Nov 16 '05 #6
Ok...

Instead of adding paint event in tabpage, do the following

1.Set DrawMode Property of TabControl to OwnerDrawnFixed
2.add DrawItem event of Tabcontrol.
3. Get the graphics pointer and center the image.

Shak.
<an*******@discussions.microsoft.com> wrote in message
news:1d*****************************@phx.gbl...
Hi Shak,

Thank you for your reply.

It worked. Unfortunately, the yDraw actually starts from
the tabpage, but not the square area that usually contains
the text/title for the tabpage.

I want the image to be centered on the square where the
title/text shown.

Thank you.
regards,
Sean

-----Original Message-----
Sean,

There is a way to center the image. you have to add Paint

Event of tab page
and get the graphics pointer

Graphics g = e.Graphics.
g.DrawImage(TestImage, new Rectangle(xDraw, yDraw,

TestImageWidth,
TestImageHeight));

xDraw, and yDraw will get you the offset to center the

image.

Shak.
"Sean" <an*******@discussions.microsoft.com> wrote in

message
news:1d*****************************@phx.gbl...
Hi,

I have a tab control containing few tab pages. On each tab pages, I put an image on the tab page's title bar (the
area on top of a tab page, ie where tooltip will appear).
If i put both an image and a text, they both will be
centered nicely. However, if I put only image without the text, the image will position itself more to the left and it is not centered.

Is it possible to have the image to be on the center?
Thank you.
regards,
Sean

.

Nov 16 '05 #7
Hi Shak,

Thank you so much for your last post.
It works! However, there is a white line between the title
bar and the tabpage even for the selectedPage. This line
wasn't there when I had the DrawMode as Normal.

Is there a way to get rid of the white line between the
title bar and the tabpage for the selectedPage?

Thank you once again.
regards,
Sean
-----Original Message-----
Ok...

Instead of adding paint event in tabpage, do the following

1.Set DrawMode Property of TabControl to OwnerDrawnFixed
2.add DrawItem event of Tabcontrol.
3. Get the graphics pointer and center the image.

Shak.
<an*******@discussions.microsoft.com> wrote in message
news:1d*****************************@phx.gbl...
Hi Shak,

Thank you for your reply.

It worked. Unfortunately, the yDraw actually starts from
the tabpage, but not the square area that usually contains the text/title for the tabpage.

I want the image to be centered on the square where the
title/text shown.

Thank you.
regards,
Sean

>-----Original Message-----
>Sean,
>
>There is a way to center the image. you have to add Paint
Event of tab page
>and get the graphics pointer
>
>Graphics g = e.Graphics.
>g.DrawImage(TestImage, new Rectangle(xDraw, yDraw,

TestImageWidth,
>TestImageHeight));
>
>xDraw, and yDraw will get you the offset to center the

image.
>
>Shak.
>
>
>"Sean" <an*******@discussions.microsoft.com> wrote in

message
>news:1d*****************************@phx.gbl...
>
>> Hi,
>>
>> I have a tab control containing few tab pages. On
each tab
>> pages, I put an image on the tab page's title bar

(the >> area on top of a tab page, ie where tooltip will

appear).
>>
>> If i put both an image and a text, they both will be
>> centered nicely. However, if I put only image without

the
>> text, the image will position itself more to the left

and
>> it is not centered.
>>
>> Is it possible to have the image to be on the center?
>> Thank you.
>>
>>
>> regards,
>> Sean
>
>
>.
>

.

Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tony Vasquez | last post by:
Can somoene give me an example of how to center a div, according to it's image size... I am using different images, and so I have to resize it in a functino according to the image's size. So I use...
19
roula
by: roula | last post by:
I HATE DIVS AND DIFFERENT BROWSERS!!! i spent the whole day and night searching for a way to center align stupid divs, the problem is that the code is so sensitive, i lost my mind trying to make them...
1
by: judacris | last post by:
I've seen the threads here about molding 2 divs in a centered fashion. but I can't seem to solve this thing. my blogger blog is functioning well on my site for now, but the blog feed (left) and...
1
by: jobs | last post by:
I have a simple login page with roughly a 300px x 300px image behind the asp.net login control. I need the login control to land in the middle of the image. I want both the image and the login...
14
by: Summercool | last post by:
in http://www.0011.com/test_size3.html to center the logo "HTML 4.01 check" button at the bottom of the page, I used <div style="width: 10px; margin: 0px auto"> </div>
24
by: GloStix | last post by:
I'm trying to center this banner, it's in a div that has the same width so it's not exactly "centering" but it's screwed up, It works in safari but in Firefox it's messed up. I uploaded a Video to...
2
by: jerrygadd | last post by:
Can some body help me vertically center an image using CSS? The customer only uses IE, and so the code is not debugged for other browsers! The image in question is found on line 1075 :...
14
by: gaijinco | last post by:
I was a hobbist web coder for years but I had to sidestep for a while. Now I'm trying to return to it and I'm trying to clarify how am I supposed to do somethings with CSS v.s. HTML and I'm...
13
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.