473,804 Members | 3,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3413
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.Client Rectangle()
g = TabPage1.Create Graphics()

g.FillRectangle (System.Drawing .Brushes.Red, rect)
--------------------
From: "VJ" <vi********@yah oo.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.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: adsl-68-94-224-66.dsl.rcsntx.s wbell.net 68.94.224.66
Path: cpmsftngxa10.ph x.gbl!TK2MSFTNG XA01.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP0 9
..phx.gblXref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:205362
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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@subtra ct_this_field.m icrosoft.com> wrote in
message news:6w******** *****@cpmsftngx a10.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.Client Rectangle()
g = TabPage1.Create Graphics()

g.FillRectangle (System.Drawing .Brushes.Red, rect)
--------------------
From: "VJ" <vi********@yah oo.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.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: adsl-68-94-224-66.dsl.rcsntx.s wbell.net 68.94.224.66
Path:

cpmsftngxa10.ph x.gbl!TK2MSFTNG XA01.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP0 9 phx.gbl
Xref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:205362
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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**********@p lanet.nl> wrote in message
news:uv******** ******@TK2MSFTN GP09.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.BackCo lor = Color.Red
"VJ" <vi********@yah oo.com> wrote in message
news:OO******** ******@TK2MSFTN GP09.phx.gbl...
Hi Cor,

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

VJ

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:uv******** ******@TK2MSFTN GP09.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.heigh t 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.BackCo lor = 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.publi c.dotnet.langua ges.vb.controls newsgroup.
news:uU******** ******@TK2MSFTN GP11.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.SQUA REBRACKETS.[mdaudi100#ntlwo rld.com]> wrote in
message news:O7******** ******@TK2MSFTN GP09.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.publi c.dotnet.langua ges.vb.controls newsgroup.
news:uU******** ******@TK2MSFTN GP11.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

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

Similar topics

5
18515
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 custom control that inherit all information from TabPage, but how to access those properties, not supported by standart interface??? Thank you
2
2372
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 controls on it. The problem is that I don't know how to bring up the graphical design interface for the TabControl. I suppose I COULD just design it as a UserControl and place a TabControl on it, but that seems a bit... inelegant (I'm going to...
9
3462
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 the are set to the right color, I can obviously change the tabpage colour but I am left with a grey top edge(Where there are no buttons) when the background of the form is changed any ideas on what I can do? Mike.
5
3353
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 advance Zadkin
2
3357
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 - including the tab control. I did this by writing a component that I attached to the form. The component has a "Start" function which takes the form as a paramater. This cycles through all the controls on the form, changes some of the properties...
2
2782
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 in a TreeView. So the the application starts by displaying no tabs and adds them in as required. There could be any number of each tab (0 upwards). What is the best way of me doing this? Should I create 3 custom controls that extend TabPage?...
1
3462
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 know how to fix this? I tried this on two computers, at work and at home, both with Windows XP with latest service packs, and Framework 2.0 and 3.0 with latest SP.
0
1421
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 to the vast amount of data to populate listviews within the tabs, I have created a worker thread (an implementation of a BackgroundWorker) to form the data and populate a tabcontrol 'offline', so that it doesn't interfer with (i.e freeze) the UI. ...
2
2122
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 (who's done a little work with this for his multi-colored listbox class), or someone else might've figured this out. Here's the scenario: DBs created on Windows XP using A2K7 are apparently incapable of displaying TabControl transparency....
2
6276
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 the tabcontrol (so that the user won't be able to change the values in the textboxes, combobox, checkbox) without the tabcontrol turn into grey.
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10589
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10085
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.