Hi,

[ BTW I'm using C# ]

I am trying to create a custom style tab control. I've managed to code it
so far so that I can custom draw the TabPage dividers ( the buttons at the
top of the TabControl that select the TabPage ).

My ultimate goal is to have fancy style TabPage dividers which overlap.
I've created a Polygon ( GraphicsPath ) to draw these, but cant work out how
to perform the HitTest of overlapping dividers ( the standard control works
off rectangles only - which is useless for my overlapping dividers!! ).

Can I intercept the HitTest message - so that I can test against my Polygon
( GraphicsPath ) and then set the SelectedTab myself ? If so a bit of sample
could would be great.

regards,
Rich.

Re: TabControl - Owner Drawn TabPage Dividers by Mick

Mick
Wed Jan 26 05:33:10 CST 2005

With the amount of work involved and the limitations you are going to face,
I would suggest recreating the TabControl from scratch, i.e. do not inherit
from TabControl. It's something I've started to do several times, but I keep
getting distracted by other projects.

If you really want to play around with the TabControl, then you'll find an
example of working with the HitTest method on my site. I have only used it
in the designer, but you can use the same method in the control itself. It
will need a little work to be used as you wish to use it, but I do not know
of any other example.
http://dotnetrix.co.uk/tabcontrols.html --> TabControl using custom
tabpages.

When taking full responsibility for drawing the tabcontrol, you will find
that the tabitemstrip does not resize in proportion to the font. For this
reason you may want to handle the message TCM_ADJUSTRECT so that you can
modify the size of the tabpage to give you more Non-Client Area. You could
send a WM_SETFONT message to the tabcontrol so as to change it's font size
internally, but you will find the method to be unreliable due to differences
between System.Drawing.Font and Win32 LogFont. This is the method I used in
the TabControlEX that is available from my Controls section.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


"RichS" <RichS@discussions.microsoft.com> wrote in message
news:3EBD4FD6-1202-45D0-A725-58A050497688@microsoft.com...
> Hi,
>
> [ BTW I'm using C# ]
>
> I am trying to create a custom style tab control. I've managed to code it
> so far so that I can custom draw the TabPage dividers ( the buttons at the
> top of the TabControl that select the TabPage ).
>
> My ultimate goal is to have fancy style TabPage dividers which overlap.
> I've created a Polygon ( GraphicsPath ) to draw these, but cant work out
> how
> to perform the HitTest of overlapping dividers ( the standard control
> works
> off rectangles only - which is useless for my overlapping dividers!! ).
>
> Can I intercept the HitTest message - so that I can test against my
> Polygon
> ( GraphicsPath ) and then set the SelectedTab myself ? If so a bit of
> sample
> could would be great.
>
> regards,
> Rich.
>
>



Re: TabControl - Owner Drawn TabPage Dividers by RichS

RichS
Wed Jan 26 06:57:03 CST 2005

Oh well, thanks for the response.

I originally started with my own TabControl, but decided to try to exploit
the WindowsForms TabControl hoping that it would be better.

I know that the use of my TabControl is going to be very limited so may I
can hack together something pretty quick.

regards,
Rich.

"Mick Doherty" wrote:

> With the amount of work involved and the limitations you are going to face,
> I would suggest recreating the TabControl from scratch, i.e. do not inherit
> from TabControl. It's something I've started to do several times, but I keep
> getting distracted by other projects.
>
> If you really want to play around with the TabControl, then you'll find an
> example of working with the HitTest method on my site. I have only used it
> in the designer, but you can use the same method in the control itself. It
> will need a little work to be used as you wish to use it, but I do not know
> of any other example.
> http://dotnetrix.co.uk/tabcontrols.html --> TabControl using custom
> tabpages.
>
> When taking full responsibility for drawing the tabcontrol, you will find
> that the tabitemstrip does not resize in proportion to the font. For this
> reason you may want to handle the message TCM_ADJUSTRECT so that you can
> modify the size of the tabpage to give you more Non-Client Area. You could
> send a WM_SETFONT message to the tabcontrol so as to change it's font size
> internally, but you will find the method to be unreliable due to differences
> between System.Drawing.Font and Win32 LogFont. This is the method I used in
> the TabControlEX that is available from my Controls section.
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>
>
> "RichS" <RichS@discussions.microsoft.com> wrote in message
> news:3EBD4FD6-1202-45D0-A725-58A050497688@microsoft.com...
> > Hi,
> >
> > [ BTW I'm using C# ]
> >
> > I am trying to create a custom style tab control. I've managed to code it
> > so far so that I can custom draw the TabPage dividers ( the buttons at the
> > top of the TabControl that select the TabPage ).
> >
> > My ultimate goal is to have fancy style TabPage dividers which overlap.
> > I've created a Polygon ( GraphicsPath ) to draw these, but cant work out
> > how
> > to perform the HitTest of overlapping dividers ( the standard control
> > works
> > off rectangles only - which is useless for my overlapping dividers!! ).
> >
> > Can I intercept the HitTest message - so that I can test against my
> > Polygon
> > ( GraphicsPath ) and then set the SelectedTab myself ? If so a bit of
> > sample
> > could would be great.
> >
> > regards,
> > Rich.
> >
> >
>
>
>