I added it to a new project, fixed the import statement and was able to build the project.
I added the TabControl to the form (really ugly default color, btw) I then added 3 tab pages to the TabPageArray and the first thing I noticed was that I can't click the tab header to switch to the other pages to add controls to it. Before I added anything to any of the tab pages I tried running it with just the three empty tabs and got this error and the form wouldn't show:
Code:
System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: The selected index must be less than the number of tabs in the XTabControl."
Source="WindowsApplication1"
StackTrace:
at WindowsApplication1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at WindowsApplication1.My.MyProject.MyForms.get_Form1()
at WindowsApplication1.My.MyApplication.OnCreateMainForm() in C:\Users\JuggaloBrotha\Desktop\WindowsApplication1\WindowsApplication1\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ArgumentException
Message="The selected index must be less than the number of tabs in the XTabControl."
Source="WindowsApplication1"
StackTrace:
at WindowsApplication1.XTabControl.set_SelectedIndex(Int32 value) in C:\Users\JuggaloBrotha\Desktop\WindowsApplication1\WindowsApplication1\XTabControl.vb:line 63
at WindowsApplication1.Form1.InitializeComponent() in C:\Users\JuggaloBrotha\Desktop\WindowsApplication1\WindowsApplication1\Form1.Designer.vb:line 47
at WindowsApplication1.Form1..ctor()
InnerException:
I've attached the project too.
Last edited by JuggaloBrotha; Jun 30th, 2010 at 02:43 PM.
Currently using VS 2015 Enterprise on Win10 Enterprise x64.
He shows you how to add design-time support for the tab control (selecting the headers), and much more. I think I have implemented the same thing in my tabcontrol with contextmenu, see my signature.
I also have a codebank submission on the Smart Tags I think, although I haven't got that in my signature for some reason. Try searching for it (try "Smart-Tag" or "Smart Tag" or other combinations or you won't find it).
I added it to a new project, fixed the import statement and was able to build the project.
I added the TabControl to the form (really ugly default color, btw) I then added 3 tab pages to the TabPageArray and the first thing I noticed was that I can't click the tab header to switch to the other pages to add controls to it. Before I added anything to any of the tab pages I tried running it with just the three empty tabs and got this error and the form wouldn't show:
Code:
System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: The selected index must be less than the number of tabs in the XTabControl."
Source="WindowsApplication1"
StackTrace:
at WindowsApplication1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at WindowsApplication1.My.MyProject.MyForms.get_Form1()
at WindowsApplication1.My.MyApplication.OnCreateMainForm() in C:\Users\JuggaloBrotha\Desktop\WindowsApplication1\WindowsApplication1\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ArgumentException
Message="The selected index must be less than the number of tabs in the XTabControl."
Source="WindowsApplication1"
StackTrace:
at WindowsApplication1.XTabControl.set_SelectedIndex(Int32 value) in C:\Users\JuggaloBrotha\Desktop\WindowsApplication1\WindowsApplication1\XTabControl.vb:line 63
at WindowsApplication1.Form1.InitializeComponent() in C:\Users\JuggaloBrotha\Desktop\WindowsApplication1\WindowsApplication1\Form1.Designer.vb:line 47
at WindowsApplication1.Form1..ctor()
InnerException:
I've attached the project too.
Um, really? I've already built a tabbed WebBrowser with it. And thanks for the color comment, I chose those because I thought they went really well with the default Control grey. Guess I was wrong Of course you can't click the tab pages to switch, I actually mentioned that in my post. Obviously you didn't read it through. I'll take a look at your project.
P.S. What is the Imports problem you're talking about?
P.P.S. @NickThissen: I know how to add these, I'm just working on the design right now.
About the movable tabs, I'm not sure why, but there is no System.Windows.Forms.Design.ControlDesigner class, so I can't inherit it.
Last edited by minitech; Apr 25th, 2010 at 05:08 PM.
Well, I got your error and I'm trying to track it down. In the meantime, could you try the DLL? That's what I used for my tabbed browser, and it seems to work.
P.S. What is the Imports problem you're talking about?
P.P.S. @NickThissen: I know how to add these, I'm just working on the design right now.
About the movable tabs, I'm not sure why, but there is no System.Windows.Forms.Design.ControlDesigner class, so I can't inherit it.
Namespace: System.Windows.Forms.Design
Assembly: System.Design (in System.Design.dll)
The name of the namespace doesn't have to match the name of the assembly, even though it almost always does in the .NET framework. I suppose they kept the Design namespace in a separate DLL because most people never use it anyway.
I've changed the designer for the code, but now the TabPages appear in the Components area underneath the form (where Timers appear). I guess the next version won't be released for a while!
Anyways, I'm adding hot-tracking and close buttons.
EDIT: Never mind, it just randomly stopped!
Last edited by minitech; Apr 29th, 2010 at 06:57 PM.
For people who don't like the color (not a huge suprise), you can make your own header renderer! Here's how:
Either implement IHeaderRenderer (harder) or inherit DefaultHeaderRenderer (easy, but less control).
Inheriting DefaultHeaderRenderer (implementing coming soon, but you should be able to figure it out):
Code:
Public Class MyHR : Inherits XTabStyle.DefaultHeaderRenderer
End Class
Change the border color by overriding:
Code:
Public Class MyHR : Inherits XTabStyle.DefaultHeaderRenderer
Protected Overrides Function GetBorderColor() As Color
Return Color.White
End Function
End Class
Change the text color, again by overriding:
Code:
Public Class MyHR : Inherits XTabStyle.DefaultHeaderRenderer
Protected Overrides Function GetBorderColor() As Color
Return Color.White
End Function
Protected Overrides Function GetTextColor() As Color
Return Color.DarkGreen
End Function
End Class
Change the font:
Code:
Public Class MyHR : Inherits XTabStyle.DefaultHeaderRenderer
Protected Overrides Function GetBorderColor() As Color
Return Color.White
End Function
Protected Overrides Function GetTextColor() As Color
Return Color.DarkGreen
End Function
Protected Overrides Function GetFont() As Font
Return New Font("Verdana",11.0!)
End Function
End Class
Change the tab background:
Code:
Public Class MyHR : Inherits XTabStyle.DefaultHeaderRenderer
Protected Overrides Function GetBorderColor() As Color
Return Color.White
End Function
Protected Overrides Function GetTextColor() As Color
Return Color.DarkGreen
End Function
Protected Overrides Function GetFont() As Font
Return New Font("Verdana",11.0!)
End Function
Protected Overrides Function GetBrush(ByVal size As Size) As Brush
Return New SolidBrush(Color.Black) 'In this example, I change the background to solid black.
End Function
End Class
Finally, set the XTabControl's HeaderRenderer property to an instance of your class.
Code:
Me.XTabControl1.HeaderRenderer = New MyHR()
Last edited by minitech; May 10th, 2010 at 07:04 PM.
Contest time: make the best tab header renderer! The top 5 elected will be included in the package. I'll add a poll for the best ones. It won't take too much time; see how easy that last example was?