Shandy's Blog

Where Andrew Sutton, aka Shandy rants and rambles on as the fancy takes him

vbCity Blogs moved to:
http://cs.vbcity.com/blogs
  Home :: Syndication  :: Login

My name is Andrew Sutton, aka Shandy.

I am currently living and working in the UK within the garment industry as an IT specialist. This blog contains mainly IT related issues.

I was a Microsoft VB MVP for a couple of years (Apr 2004-Mar 2006) and was a vbCityLeader between April 2003 and June 2007.

If you are looking for my Sri Lanka or Morocco experiences check out Shandy's Sri Lanka Blog or Shandy's Morocco Blog. My personal (Non IT) blog is now at Shandy's Place

JunJuly 2009Aug
SMTWTFS
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

Articles

Archives

Topics

Image Galleries

.NET

Blogs I Read

Others

VB.Classic

I feel a bit like a mountain climber everytime I try and do something with the .NET tab control. I just know there is going to be some new obstacles to overcome. Today I noticed on this thread at vbCity an interesting question, How do I make it when I select a tab, the other one Dims, or looks inactive. and so decided to try and answer it.

The first major problem was that the tab control simply doesn't support any sort of altering of the tab text directly. When you disable the tab all the controls on the tab become disabled, not the tab itself. This lead onto the two issues I needed to overcome, namely

  • I had no idea how to control the drawing of the tab text.
  • I've never actually found out what is involved in making a control look disabled.
  • Never one to let small problems like that put me off I returned to a site that djjeavons had pointed out to me in this post, Re: How do I disable or make a tab control tab invisible.The web site is Mick Dohertys DotNet Tips - TabControl. Mick has some excellent code examples for how to extend the tab control's functionality.

    Mick had some code that showed how to change the colours of the tab text and background and so after a few minutes spent trawling the internet to find out what colours I should be using to make a control look disabled I was able to perform a small tweak to Mick's code and get the non-selected tabs to look disabled.

    For the record it appears that for a disabled control the background colour should remain the same but the text colour should change to System.Drawing.SystemColors.GrayText. I posted the code and hope it provides the solution extatic was looking for. I'll add this functionality to my tab control extension class.

    posted on Thursday, April 14, 2005 3:03 AM