Re: Customizable TabControl
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.
Re: Customizable TabControl
I've got the same problem as JuggaloBrotha, form won't show, something with a selected index out of range.
Also, the imports statement is wrong (I think you may have renamed the project or something but didn't rename the import statement).
Oh, and you can move the tabpages around :p (fix this in the designer for the tabpages, override the SelectionRules property and return Locked).
For your updates, you may want to check out most of the control here if you haven't already:
http://dotnetrix.co.uk/tabcontrol.htm
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).
Re: Customizable TabControl
Quote:
Originally Posted by
JuggaloBrotha
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 :sick: 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.
Re: Customizable TabControl
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. :(
Re: Customizable TabControl
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.
Re: Customizable TabControl
Ok, it looks like the designer is deserializing the SelectedIndex property before the TabPagesArray (I wonder why it doesn't happen to me?)
I'll upload a fixed copy. Thanks for pointing that out!
P.S. There's an Imports problem because the control was developed in a project called "TabControlPlus". I've added a comment in the code now.
Re: Customizable TabControl
Re: Customizable TabControl
Quote:
Originally Posted by
minitech
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. :(
You need to add a reference to System.Design.
Re: Customizable TabControl
Add a reference to System.Design to use System.Windows.Forms.Design? That's strange. Ok, I'll try that.
Re: Customizable TabControl
Quote:
Originally Posted by
minitech
Add a reference to System.Design to use System.Windows.Forms.Design? That's strange. Ok, I'll try that.
Yes, the System.Windows.Forms.Design namespace is in the System.Design.dll assembly.
It says so right in MSDN:
http://msdn.microsoft.com/en-us/libr...ldesigner.aspx
Quote:
ControlDesigner Class
Extends the design mode behavior of a Control.
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.
Re: Customizable TabControl
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!
Re: Customizable TabControl
Re: Customizable TabControl
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()
Re: Customizable TabControl
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?