[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 688
  • Last Modified:

Orange bar on Tabs

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
Mr_Fulano
Asked:
Mr_Fulano
  • 5
  • 4
  • 3
2 Solutions
 
ptakjaCommented:
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
 
SanclerCommented:
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
 
ptakjaCommented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Mr_FulanoAuthor Commented:
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
 
ptakjaCommented:
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
 
SanclerCommented:
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
 
Mr_FulanoAuthor Commented:
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
 
ptakjaCommented:
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
 
ptakjaCommented:
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
 
Mr_FulanoAuthor Commented:
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
 
SanclerCommented:
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
 
Mr_FulanoAuthor Commented:
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

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now