Results 1 to 12 of 12

Thread: [RESOLVED] [2005] Left alignment in tabcontrol

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    160

    Resolved [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.

  2. #2
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    160

    Re: [2005] Left alignment in tabcontrol

    Quote 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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Left alignment in tabcontrol

    If you use the Skybound VisualStyles component the TabControl will draw correctly without additional help.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Left alignment in tabcontrol

    Quote 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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    160

    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?

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    160

    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.

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width