|
-
Jul 9th, 2007, 02:53 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2005] Left alignment in tabcontrol
I've seen that in order to properly display the tabpages when using alignments aside from the top one and applying the visual styles the DrawItem event is used.
I've already played a bit with it, but since I don't have too much time I was wondering if anyone out there could provide the proper code to make the tabs look like the standard ones, with the orange line when the mouse is over the tab page and all that.
Thanks in advance.
-
Jul 9th, 2007, 09:02 AM
#2
Re: [2005] Left alignment in tabcontrol
maybe you could adapt code from THIS thread
HTH
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jul 9th, 2007, 10:55 AM
#3
Thread Starter
Addicted Member
Re: [2005] Left alignment in tabcontrol
 Originally Posted by kebo
maybe you could adapt code from THIS thread
HTH
kevin
Well, as I've said I already know how to use the DrawItem in order to customize the tabs (well, I bet that not half as well as most people here heh), but I was wondering if anyone happens to have some code to make them look like the standard XP ones.
-
Jul 9th, 2007, 06:21 PM
#4
Re: [2005] Left alignment in tabcontrol
If you use the Skybound VisualStyles component the TabControl will draw correctly without additional help.
-
Jul 9th, 2007, 06:50 PM
#5
Re: [2005] Left alignment in tabcontrol
It only takes turning on and applying the visual styles to your app by making sure you have the framework enabled in the project properties. If you are using a Sub Main module for your startup with the framework disabled then your first lines of code in the event will be to enable the VS.
Application.EnableVisualStyles
Application.DoEvents
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 9th, 2007, 09:10 PM
#6
Re: [2005] Left alignment in tabcontrol
 Originally Posted by RobDog888
It only takes turning on and applying the visual styles to your app by making sure you have the framework enabled in the project properties. If you are using a Sub Main module for your startup with the framework disabled then your first lines of code in the event will be to enable the VS.
Application.EnableVisualStyles
Application.DoEvents
Even in .NET 2.0 the TabControl does not display properly with visual styles enabled if the Alignment property is anything but Top. The Skybound VisualStyles component fixes that issue without any additional code.
-
Jul 9th, 2007, 10:31 PM
#7
Re: [2005] Left alignment in tabcontrol
Alignment - Left. I was thinking of something else but yes that is buggy.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 10th, 2007, 07:30 AM
#8
Thread Starter
Addicted Member
Re: [2005] Left alignment in tabcontrol
The VisualStyles component is nice, but it's giving me some problems, mainly with a custom control:
I draw some ellipses, using CreateGraphics in the control BG, and when I place the control in a tab the graphics drawn disappear.
Any tip? or any other way of drawing those ellipses?
-
Jul 10th, 2007, 07:54 PM
#9
Re: [2005] Left alignment in tabcontrol
I have my doubts that it the VS component that's doing that. Where exactly are you doing this drawing? I'm guessing that you're doing it in the wrong place because if you were overriding the OnPaint method you would already be provided with a Graphics object so you wouldn't have to call CreateGraphics.
-
Jul 10th, 2007, 07:58 PM
#10
Re: [2005] Left alignment in tabcontrol
Sounds like you are drawing in the wrong event and so when the region gets invalidated it does not redraw your elipses etc.
For best performance you will want to only override the control that you are drawing on OnPaint event. If you are drawing on the form then it would be overridding the forms OnPaint event.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 11th, 2007, 01:49 AM
#11
Thread Starter
Addicted Member
Re: [2005] Left alignment in tabcontrol
Well, I'm actually using the control Paint event, but don't use the painteventargs because of some options of the control that makes impossible to just deppend of it.
I've tried to use the graphic object on the Paint event, and it does solve the problem.
-
Jul 11th, 2007, 02:06 AM
#12
Re: [2005] Left alignment in tabcontrol
Its better to use the e.Graphics event parameter since its alreay created instead of coding in the creation of the CreateGRaphincs method.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|