Solved

VB.NET Custom TabControl / TabPage

Posted on 2003-11-24
6
3,326 Views
Last Modified: 2008-01-16
I have created my own TabPage (inherited from Windows.Forms.TabPage) and I am now attemping to create my own TabControl (inherited from Windows.Forms.TabControl) so that I can use the verbs to add and remove my own tab pages from the tabcontrol.

I sort of go the verb part working ok, however, in the designer, when I have more than 1 tab it does not allow me to click on the additional tabs.

What am I doing wrong? I believe I am missing something from my designer class because if I remove my custom designer, i can now click on the additional tabs.

Thanks
0
Comment
Question by:liebrand
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Are you overriding any of the normal behavior of the control?
0
 
LVL 15

Author Comment

by:liebrand
Comment Utility
nope... do the following:

<Designer("MyTabControlDesigner")> _
Public Class MyTabControl
   inherits system.windows.forms.tabcontrol

end Class

Public Class MyTabControlDesigner
    inherits System.Windows.Forms.Design.ControlDesigner

End Class

And you will see that if you add tabs, you cannot select them.
0
 
LVL 15

Author Comment

by:liebrand
Comment Utility
I figured it out ... i landed up doing the following in my designer:

        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            Dim p As System.Drawing.Point
            Dim n As TickerTabPage

            If m.Msg = WM_LBUTTONDOWN Then
                p = New System.Drawing.Point(m.LParam.ToInt32())

                For index As Integer = 0 To _Control.TabPages.Count - 1
                    Dim tabRec As System.Drawing.Rectangle = _Control.GetTabRect(index)
                    If (tabRec.Contains(p)) Then
                        _Control.SelectedIndex = index
                    End If
                Next
            End If
            MyBase.WndProc(m)
        End Sub
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Accepted Solution

by:
PashaMod earned 0 total points
Comment Utility
Question closed and points refunded

PashaMod
CS Moderator
0
 

Expert Comment

by:Bharat Guru
Comment Utility
i syour tab will work in Netscape
0
 

Expert Comment

by:brookd
Comment Utility
Can you access a tab by name/ID,  not by the integer index?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now