This is my code bellow:- - private void _tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
-
{
-
Font f;
-
Brush backBrush;
-
Brush foreBrush;
-
-
if (e.Index == this._tabControl1.SelectedIndex)
-
{
-
f = new Font(e.Font, FontStyle.Bold | FontStyle.Regular);
-
backBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.Gainsboro, Color.Gainsboro, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
-
foreBrush = Brushes.Black;
-
}
-
else
-
{
-
f = e.Font;
-
backBrush = new SolidBrush(e.BackColor);
-
foreBrush = new SolidBrush(e.ForeColor);
-
}
-
-
string tabName = this._tabControl1.TabPages[e.Index].Text;
-
StringFormat sf = new StringFormat();
-
sf.Alignment = StringAlignment.Center;
-
e.Graphics.FillRectangle(backBrush, e.Bounds);
-
Rectangle r = e.Bounds;
-
r = new Rectangle(r.X, r.Y + 3, r.Width, r.Height - 3);
-
e.Graphics.DrawString(tabName, f, foreBrush, r, sf);
-
sf.Dispose();
-
if (e.Index == this._tabControl1.SelectedIndex)
-
{
-
f.Dispose();
-
backBrush.Dispose();
-
}
-
else
-
{
-
backBrush.Dispose();
-
foreBrush.Dispose();
-
}
-
}
This is a code of coloring Tab from my window application. And I want the exact color Mercury (E6E6E6 or 230, 230, 230) of tabs . I'm unable to do that. Help me out ASAP. Also check the attachment and let me know if you can change the back color also to Tab color.
3 10322
What exactly do you want?
The Color class has properties that allow you to get the RGB values from it.
They are sneakily named .R, .G, .B
There are your 3 integer values.
You can also create a Color object with Color.FromArgb(R,G,B). Allowing you to create a color from three values.
The .ToString() for integer values has an overload that lets you specify .ToString("X") which will print the number as a HEX value.
Please use MSDN for these VERY simple answers.
Thanx Mr. paltter,
I'm just a beginner in c#
your code Color.FromArgb(230, 230, 230) worked great.
Let me know if i can put image in tabs. I'm attaching screenshot (made by a graphic designer) that what want exactly.
Also i want to color the Backgroud of Tabs also which is taking default window color right now. Click here for screenshot.
Thanx
Existing-
Newer-
Yeah, I asked that very same question about the tab-bar background area.
I didn't get very far.
I *THINK* you can do it with the owner-draw stuff, but creating the tabs were not easy.
Other then that I don't really know.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Joel Moore |
last post by:
Maybe I'm just easily baffled after an all-nighter but I can't seem to
figure out how to represent a BitArray as a hexadecimal string.
For example:
Dim outputBank As New BitArray(8)
...
|
by: Yosh |
last post by:
Morning!
I am developing an winform application in c#. I have an app.config file that
contains an entry with a Url address assigned to it. When I run my
application I get the following error:
...
|
by: Phil Stanton |
last post by:
When designing a new form or report, the Default ForeColor is often
something like -2147483640 which is the colour of Windows text (possibly
black) and the default backColor is -2147483643...
|
by: FalkoG |
last post by:
Hello colleague
I want to convert a floating number for example 5236.9856982 to a
hexadecimal number.
I'd tried several things but my problem is to convert the position
after decimal point. I...
|
by: MrKrich |
last post by:
I want to convert Hexadecimal or normal integer to Binary. Does VB.Net has function to do that? I only found Hex function that convert normal integer to Hexadecimal.
|
by: muss |
last post by:
how to convert decimal number in a hexadecimal number using C?
Please help me.
Thanks.
|
by: elliotng.ee |
last post by:
I have a text file that contains a header 32-bit binary. For example,
the text file could be:
%%This is the input text
%%test.txt
Date: Tue Dec 26 14:03:35 2006...
|
by: mahet |
last post by:
Anders Jansson was a guest here, and he was having problem:
When I try to build the web, this error is displayed:
--->
Error 5 Unable to convert input xml file content to a DataSet.
Invalid...
|
by: sweeet_addiction16 |
last post by:
hello
Im writin a code in c...
can sum1 pls help me out in writing a c code to convert decimalnumber
to hexadecimal number.The hexadecimal number generated has to be an
unsigned long.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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,...
|
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...
|
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...
|
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...
| |