Solved

Orange bar on Tabs

Posted on 2006-07-21
12
677 Views
Last Modified: 2010-05-18
Hi, This question is worth 250 points and they will be awarded to the person that provide a "specific" answer to my question below.

My question is regarding the small orange bar that appears at the top of a TAB, when that tab is selected. In other words, I've noticed on some VB application that if you select a tab from a group of tabs, the selected tab will have a thin orange bar above the tab name to indicate that it is "selected".  Windows XP uses these same orange bars on their tabs. If you go to Start > Control Panel > Folder Options for example, you'll notice that there are 3 tabs (General, View, and File Types). Depending on the tab that is selected (or on top), the little orange bar will appear.

I would like to know how to produce that same effect on my applications. I have seen it in other custom made VB apps, but do not know how its being done. An example is listed below.

Does anyone know how to do this? -- Keep in mind, I do not wish to add an icon, but rather make the orange bar appear on the selected tab.

As mentioned above, included is the code for one of the tabs in the custom VB app that I found on the Internet that uses these orange bars, but I cannot determine how the developer is producing the bar effect. If anyone can help decipher this it would be great. Please see code below:
 
START ===============================================
Me.TabControl1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.TabControl1.Controls.Add(Me.TabPage1)
        Me.TabControl1.Controls.Add(Me.TabPage2)
        Me.TabControl1.Controls.Add(Me.TabPage3)
        Me.TabControl1.Controls.Add(Me.TabPage4)
        Me.TabControl1.Location = New System.Drawing.Point(8, 40)
        Me.TabControl1.Name = "TabControl1"
        Me.TabControl1.SelectedIndex = 0
        Me.TabControl1.Size = New System.Drawing.Size(456, 288)
        Me.TabControl1.TabIndex = 0
        '
        'TabPage1
        '
        Me.TabPage1.BackColor = System.Drawing.Color.White
        Me.TabPage1.Controls.Add(Me.Label18)
        Me.TabPage1.Controls.Add(Me.Label19)
        Me.TabPage1.Controls.Add(Me.TextBox2)
        Me.TabPage1.Controls.Add(Me.Button2)
        Me.TabPage1.Controls.Add(Me.Button1)
        Me.TabPage1.Controls.Add(Me.TextBox1)
        Me.TabPage1.Location = New System.Drawing.Point(4, 22)
        Me.TabPage1.Name = "TabPage1"
        Me.TabPage1.Size = New System.Drawing.Size(448, 262)
        Me.TabPage1.TabIndex = 0
        Me.TabPage1.Text = "QuotedPrintable"
END ================================================

Thanks!
0
Comment
Question by:Mr_Fulano
  • 5
  • 4
  • 3
12 Comments
 
LVL 14

Accepted Solution

by:
ptakja earned 200 total points
ID: 17159772
I don't think the standard Microsoft tab control supports this feature. However, I have the Infragistics NetAdvantage suite installed on my development machine. Inside that suit is the UltraTabControl which looks exactly like the Windows tab control.

The standard tab control does support Hot Tracking, but all it does is change the color of the font when you mouse over a tab. The Infragistics control has the orange bar above the tab text.

Check it out at http://www.infragistics.com
0
 
LVL 34

Assisted Solution

by:Sancler
Sancler earned 200 total points
ID: 17161157
In VB.NET 2005 the behaviour you want is "by default" if "Enable XP Visual Styles" is checked in the "Windows Application framework properties" panel on the Application tab in the Solution Properties Window.

Roger
0
 
LVL 14

Expert Comment

by:ptakja
ID: 17161287
Note that I tried the Enable XP Visual Styles in VB.NET 2003 and it didn't have any effect.

The MS Grid control in 2005 has been SIGNIFICANTLY enhanced over the 2003 edition.
0
 

Author Comment

by:Mr_Fulano
ID: 17161352
I understand better now. I'm using VS.2003, so the little orange bar seems to be out of the question for me, however, is there a way to use "Hot Tracking" to my advantage here?  In other words, is there a way to control Hot Tracking property so that when a specific tab is selected, the font is changed to say "Bold - Red" and remains that way until another tab is selected and so on?  I guess what I want to do, which is draw you attention to that tab without icons, would work if I could get the tab font to change when a tab is selected and back to regular non-bold black font when not.  Any ideas.  -- BTW, I will make sure both of you receive points on this one, as you both have provided good answers.  

Thanks,
FDT
0
 
LVL 14

Expert Comment

by:ptakja
ID: 17161457
I don't see any properties to control that. Have you considered changing the appearance of the tabs to buttons?

 TabControl1.Appearance = TabAppearance.Buttons

This makes it much more obvious to determine what tab has been selected.
0
 
LVL 34

Expert Comment

by:Sancler
ID: 17161683
I agree with ptakja.  The problem is that the tabcontrol's tabs are (or appear to me to be) a single graphical unit.  As ptakja says, there doesn't seem to be any property that will allow you to alter just the appearance of a selectedindex tab (as opposed to the page).  But in-built into, and reacted to by, that single graphical unit is button state.  With either Buttons or FlatButtons a pretty striking visual clue is given as to which page is selected.

Roger
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Mr_Fulano
ID: 17161808
So what I'm hearing you both say is that there is NO way to programmatically, either change the font of the tab's name, or the tab's appearance, when its selected. Is that correct? If not, how would I do either?
0
 
LVL 14

Expert Comment

by:ptakja
ID: 17161912
What I would say is I am sure there is some way. However, you need to weigh the value of your time. I don't know if you are writing your program for something personal or professional. If it's the latter, the amount of time you would invest in researching the solution and then coding it (which wouldn't be trivial, or we would have already given you the answer!) * your cost to the company (say it's $100/hr) would far exceed the $500 you would spend on the Infragistics components.

You have already spent at least 12 hours on this (based on the timing of your post) + the time you spent BEFORE you posted your question. So at $100/hr you've already spent $1200-1500 on this one issue.

This is where the cost of third party components really pays off!

It's something to consider.

Of course, then there's the academic perspective, where one wants to solve the problem oneself for the learning experience. While I am all for learning, at some point you need to weigh the benefits and practicality of the solution to the amount of effort it would take to get there.

In my opinion, if someone has already figured this out and I can buy it for $500, then why re-invent the wheel?

For what its worth...

Jeff
0
 
LVL 14

Expert Comment

by:ptakja
ID: 17161918
One thing you could try, but again, the amount of code would be significant, is to create a custom user control that is inherited from the Tab control. Then you could paint whatever you wanted in that area, once you figure out where that area is...
0
 

Author Comment

by:Mr_Fulano
ID: 17162393
I understand what you're saying, but I simply can't believe that I'm the only one that finds the Tab control hard to read in terms of which tab is really selected.  I would have to believe that someone has found a work-around. So, therefore I ask... if you don't ask, you'll never expand your horizons. As for creating my own control, I don't think I'm skilled enough to do that just yet - maybe one day.  

Thanks,
FDT
0
 
LVL 34

Expert Comment

by:Sancler
ID: 17162753
I agree wholeheartedly with ptakja.  

The only thing I'd add is that you could achieve exactly the effect you want without extensive self coding or without shelling-out on a third party product.  Visual Basic 2005 Express Edition is downloadable for free.  I've just imported a VB.NET 2003 project containing a tab control into that.  I adjusted the configuration properties and ran it.  The yellow bar appeared over the selected tab.

Roger
0
 

Author Comment

by:Mr_Fulano
ID: 17163449
Thanks to the both of you. I didn't know of the 3rd party product you advised about prior to asking my question. I also hadn't thought of importing the app into VB 2005, which may work just as well. I'll add more points and split them 200 each, as you both have been helpful. Thanks again.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

13 Experts available now in Live!

Get 1:1 Help Now