473,386 Members | 1,752 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,386 software developers and data experts.

TabControl

VJ
Is there any way I can get the rectangle area of the TabPage area only of a
TabControl.

I am trying here to paint my tabpage area with one color and tabPage tabs in
a different color.

Thanks
VJ
Nov 20 '05 #1
10 3355
Sure, suppose you have a tabpage called TabPage1. The following code will
paint just the client area of the tab page red:

Dim rect As Rectangle
Dim g As System.Drawing.Graphics

rect = TabPage1.ClientRectangle()
g = TabPage1.CreateGraphics()

g.FillRectangle(System.Drawing.Brushes.Red, rect)
--------------------
From: "VJ" <vi********@yahoo.com>
Subject: TabControl
Date: Tue, 25 May 2004 16:20:04 -0500
Lines: 10
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <OP**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: adsl-68-94-224-66.dsl.rcsntx.swbell.net 68.94.224.66
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP09
..phx.gblXref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vb:205362
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Is there any way I can get the rectangle area of the TabPage area only of a
TabControl.

I am trying here to paint my tabpage area with one color and tabPage tabs ina different color.

Thanks
VJ


Nov 20 '05 #2
VJ
That did not work.. it paints the entire area including the tab headers.. I
want just the page area to paint red...

I understand what you are saying.. I too read the help that says the client
rectangle gives the page area width, but unfournately it paints the entire
area red.. Is it because that I have also code to paint the tabs in
different color and the property DrawMode set to OwnerDrawFixed?

VJ

"Francis Ingels [MSFT]" <ringels@subtract_this_field.microsoft.com> wrote in
message news:6w*************@cpmsftngxa10.phx.gbl...
Sure, suppose you have a tabpage called TabPage1. The following code will
paint just the client area of the tab page red:

Dim rect As Rectangle
Dim g As System.Drawing.Graphics

rect = TabPage1.ClientRectangle()
g = TabPage1.CreateGraphics()

g.FillRectangle(System.Drawing.Brushes.Red, rect)
--------------------
From: "VJ" <vi********@yahoo.com>
Subject: TabControl
Date: Tue, 25 May 2004 16:20:04 -0500
Lines: 10
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <OP**************@TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: adsl-68-94-224-66.dsl.rcsntx.swbell.net 68.94.224.66
Path:

cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP09 phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vb:205362
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Is there any way I can get the rectangle area of the TabPage area only of aTabControl.

I am trying here to paint my tabpage area with one color and tabPage tabs

in
a different color.

Thanks
VJ

Nov 20 '05 #3
Hi VJ,

I come in, do not know the problem however why than not just adjust the size
of the rectangle?

Cor
Nov 20 '05 #4
VJ
Hi Cor,

I am trying to put my math skills to full test in determining the rectangle
area.. :-)...

VJ

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hi VJ,

I come in, do not know the problem however why than not just adjust the size of the rectangle?

Cor

Nov 20 '05 #5
Why not set the tab page background to the desired color? Or am I missing
something here?

TabPage1.BackColor = Color.Red
"VJ" <vi********@yahoo.com> wrote in message
news:OO**************@TK2MSFTNGP09.phx.gbl...
Hi Cor,

I am trying to put my math skills to full test in determining the rectangle area.. :-)...

VJ

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hi VJ,

I come in, do not know the problem however why than not just adjust the

size
of the rectangle?

Cor


Nov 20 '05 #6
Hi VJ,

The rectangle has a rectangle.height and a rectangle.width property, I have
the same problem as you however I think that we can do that both?

:-)

Cor
I am trying to put my math skills to full test in determining the rectangle area.. :-)...

Nov 20 '05 #7
* "yEaH rIgHt" <nospam@haha> scripsit:
Why not set the tab page background to the desired color? Or am I missing
something here?

TabPage1.BackColor = Color.Red


This won't change the color of the tab's border and header.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8
A little more info on your situation is needed. The answers which others
have provided look like good answers to me. and is the reason that I have
not jumped in earlier. Perhaps you've asked the wrong question.

I take it you have an Inherited TabControl. Where and how are you doing the
painting?

you can get the tabcontrols Tabpage Rectangle by using:

Dim MyRect as Rectangle
If MyBase.TabCount > 0 Then
MyRect = Mybase.TabPages(0).Bounds
End If

Here's a link to some code for a complete Owner Draw Tab control that I
posted in the microsoft.public.dotnet.languages.vb.controls newsgroup.
news:uU**************@TK2MSFTNGP11.phx.gbl

Modify it to show the appearance that you want.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.683 / Virus Database: 445 - Release Date: 12/05/2004
Nov 20 '05 #9
VJ
That did the trick... thanks

VJ

"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:O7**************@TK2MSFTNGP09.phx.gbl...
A little more info on your situation is needed. The answers which others
have provided look like good answers to me. and is the reason that I have
not jumped in earlier. Perhaps you've asked the wrong question.

I take it you have an Inherited TabControl. Where and how are you doing the painting?

you can get the tabcontrols Tabpage Rectangle by using:

Dim MyRect as Rectangle
If MyBase.TabCount > 0 Then
MyRect = Mybase.TabPages(0).Bounds
End If

Here's a link to some code for a complete Owner Draw Tab control that I
posted in the microsoft.public.dotnet.languages.vb.controls newsgroup.
news:uU**************@TK2MSFTNGP11.phx.gbl

Modify it to show the appearance that you want.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.683 / Virus Database: 445 - Release Date: 12/05/2004

Nov 20 '05 #10
You can try the XTabControl from http://www.springsys.com, this control
supports what you want.
-Martin
"VJ" <vi********@yahoo.com> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
Is there any way I can get the rectangle area of the TabPage area only of a TabControl.

I am trying here to paint my tabpage area with one color and tabPage tabs in a different color.

Thanks
VJ

Nov 20 '05 #11

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

Similar topics

5
by: Tamir Khason | last post by:
How be able to manage more deeply UI of TabControl and TabPage For example - I want to manage border color, change color of TabPage reef, eliminate spaces from both sides of the reef, so I bould...
2
by: Patrick McGuire | last post by:
I want to place a tabControl with almost identical properties on several forms. I think the best way is to define a UserControl that inherits System.Windows.Forms.TabControl, and place all my...
9
by: Michael Turner | last post by:
Hi Guys Having problem with the tab control, I need to set the background color to something different than the standard, I have found code on the web and now can redraw the tabpage buttons so...
5
by: Zadkin | last post by:
Does anyone know, if it's possible to set the orientation of the tabpagebuttons to horizontal instead of vertical when the alignment property of my tabcontrol is set to left or right? Thanks in...
2
by: Simon Verona | last post by:
I have a few hundred forms in my application. All are based on a custom base form class. I decided that I wanted to globally change the look and feel of many of the controls in my application -...
2
by: Gav | last post by:
I am writing an application where I will have a TabControl and 3 styles of Tabs to go in it, each containing different controls. The tabs will be added to the tabcontrol when items are clicked on...
1
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all In a Visual Studio 2005 C# project, I have a simplest tabcontrol with two tabpages. When I set tab control's Alignment property to Right, tab texts (captions) disappear. Does anybody...
0
by: bertie78 | last post by:
Hi all, New poster here! I'm having some difficulty updating a tabcontrol cross-threads. The general idea is : the main thread is the owner of the tab control and the form controls. However, due...
2
by: Jamey | last post by:
Ran into an inconvenience with TabControls yesterday. I found a partial explanation from Allen Browne on the MS message boards explaining when it happens, but not why. I thought Stephen Lebans...
2
by: Claudia Fong | last post by:
Hi, I added a tabcontrol in a panel in my form. My tabcontrol have more than 3 pages.. each page contains textboxes, combobox, checkbox. I want to disable the items of each of the page of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.