473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Tab Pages text help

Is there a way to change the Text format for just the Tab Title?

I have a form with 3 tabs on it
[Tab One][Tab Two][Tab Three]

If conditions are met I would like to modify the text on the tab it'sself so
the user knows there is something there
For example I would like the text [Tab One] to be bold... I can't find a
way to do this.
Nov 16 '05 #1
1 2028
Hi NewGuy,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need the text in tabcontrol to be
bold. If there is any misunderstanding, please feel free to let me know.

Searching in google, there are many people doing the same thing. First, we
set DrawMode property of the TabControl to OwnerDrawFixed. Then, we handle
the DrawItem event to draw our own text with particular fonts. Here is an
example:

private void tabControl1_DrawItem(object sender,
System.Windows.Forms.DrawItemEventArgs e)
{
Font tabFont = e.Font;
Brush backGroundBrush = new SolidBrush(SystemColors.Control);
Brush foreGroundBrush = new SolidBrush(SystemColors.WindowText);

TabControl aTabControl = (TabControl) sender;
TabPage tabPage = aTabControl.TabPages[e.Index];
string tabName = aTabControl.TabPages[e.Index].Text;

StringFormat tabStringFormat = new StringFormat();

Rectangle tabRectangle = new Rectangle(
e.Bounds.X
, e.Bounds.Y + 4
, e.Bounds.Width + 4
, e.Bounds.Height);

if ( e.Index == aTabControl.SelectedIndex)
{
tabFont = new Font(tabFont, FontStyle.Bold);
}

//Paint Tab Background
e.Graphics.FillRectangle(backGroundBrush, e.Bounds);
//Draw Tab Text
e.Graphics.DrawString(tabName, tabFont, foreGroundBrush, tabRectangle,
tabStringFormat);
}

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeff Sandler | last post by:
I need to preserve some values over several pages. I want the user to enter his username, password and the IP address of the MySQL server at the beginning of a series of pages. I want all the...
7
by: PaulThomas | last post by:
I am fighting with XP-Pro and VS.Net trying to allow some of the pages in my application to be accessable by 'all' I am using <authentication mode="Forms" /> and if I Login - everything works...
10
by: st4 | last post by:
Help, As part of my family history web site i need to get 150 pages of typed text into some format to display. It just text right now but I would like to add some graphics (photos) and make the...
4
by: ferg | last post by:
I've checked all the FAQs and help - spent a couple of hours on this now and it's really bugging me. I've got Moin 1.3.5 installed on IIS 5.0. I can view and edit pages without any problems, but...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
4
by: m.shidoshi | last post by:
I was recently put in charge of heading up my company's website, and while I have a lot of experience on the design side of things, I'm still very new to the programming side. When I started, the...
3
by: Paul | last post by:
I found a great site for CSS tempaltes, http://blog.html.it/layoutgala/ . I downloaded them, and played around with them. Then I tried to use the template in as ASP.Net MasterPage, but everything...
17
by: MeerkatInFrance | last post by:
There comes a time when you know you are not going to be able to work something out yourself, however hard you try. I have reached that moment. I have a master page and a slave page (or whatever...
47
by: mukeshrasm | last post by:
Hi I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box. Main problem is that it is not showing the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.