473,804 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tabpages

Hi,

I wanted to know how i can make the title that is
displayed in a tabpage bold when it is selected.
I have 4 tabpages and i want the user to know more
clearly which one is selected.

I tried to do this but for some reason all the text on
that particular page turns bold.
Can any one give me some pointers?

Thx in advance.
btw im using VB.NET

Jul 21 '05 #1
8 3749
You'll have to set the TabControls DrawMode property to OwnerDrawFixed and
draw the text in the TabControls DrawItem procedure.

VB.Net example:
\\\
Private Sub TabControl1_Dra wItem(ByVal sender As Object, _
ByVal e As System.Windows. Forms.DrawItemE ventArgs) _
Handles TabControl1.Dra wItem

Dim r As RectangleF = RectangleF.op_I mplicit(e.Bound s)
Dim ItemBrush As New SolidBrush(TabC ontrol1.BackCol or)
Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center
sf.LineAlignmen t = StringAlignment .Center

If CBool(e.State And DrawItemState.S elected) Then
e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)
e.Graphics.Draw String(TabContr ol1.TabPages(e. Index).Text, _
New Font(e.Font, FontStyle.Bold) , _
Brushes.Black, _
r, sf)
Else
e.Graphics.Draw String(TabContr ol1.TabPages(e. Index).Text, _
e.Font, _
Brushes.Black, _
r, sf)
End If

End Sub
///
Note that if the Tabpage Font does not support Fonstyle.Bold then the
function will fail. In this case use:
\\\
New Font(Font.FontF amily.GenericSa nsSerif, _
e.Font.SizeInPo ints, _
FontStyle.Bold, _
GraphicsUnit.Po int)
///
in place of:
New Font(e.Font, Fonstyle.Bold)

If you have XP Visual Styles then a lot more work is required as you'll have
to PInvoke various uxtheme.dll Functions in order to draw the TabPage Header
Items.
"Alexia" <s@d> wrote in message
news:09******** *************** *****@phx.gbl.. .
Hi,

I wanted to know how i can make the title that is
displayed in a tabpage bold when it is selected.
I have 4 tabpages and i want the user to know more
clearly which one is selected.

I tried to do this but for some reason all the text on
that particular page turns bold.
Can any one give me some pointers?

Thx in advance.
btw im using VB.NET

Jul 21 '05 #2
Hi Mick

where do i write this code? Does it go in the onclick
event for each tabpage?
does the actual tabpage title not have a bold function
that will work specifically for just that text and not
everything else on that page?

thx
-----Original Message-----
You'll have to set the TabControls DrawMode property to OwnerDrawFixed anddraw the text in the TabControls DrawItem procedure.

VB.Net example:
\\\
Private Sub TabControl1_Dra wItem(ByVal sender As Object, _ ByVal e As System.Windows. Forms.DrawItemE ventArgs) _ Handles TabControl1.Dra wItem

Dim r As RectangleF = RectangleF.op_I mplicit(e.Bound s)
Dim ItemBrush As New SolidBrush(TabC ontrol1.BackCol or)
Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center
sf.LineAlignmen t = StringAlignment .Center

If CBool(e.State And DrawItemState.S elected) Then
e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)
e.Graphics.Draw String(TabContr ol1.TabPages (e.Index).Text, _ New Font(e.Font, FontStyle.Bold) , _ Brushes.Black, _
r, sf)
Else
e.Graphics.Draw String(TabContr ol1.TabPages (e.Index).Text, _ e.Font, _
Brushes.Black, _
r, sf)
End If

End Sub
///
Note that if the Tabpage Font does not support Fonstyle.Bold then thefunction will fail. In this case use:
\\\
New Font(Font.FontF amily.GenericSa nsSerif, _
e.Font.SizeInPo ints, _
FontStyle.Bold, _
GraphicsUnit.Po int)
///
in place of:
New Font(e.Font, Fonstyle.Bold)

If you have XP Visual Styles then a lot more work is required as you'll haveto PInvoke various uxtheme.dll Functions in order to draw the TabPage HeaderItems.
"Alexia" <s@d> wrote in message
news:09******* *************** ******@phx.gbl. ..
Hi,

I wanted to know how i can make the title that is
displayed in a tabpage bold when it is selected.
I have 4 tabpages and i want the user to know more
clearly which one is selected.

I tried to do this but for some reason all the text on
that particular page turns bold.
Can any one give me some pointers?

Thx in advance.
btw im using VB.NET

.

Jul 21 '05 #3
Just copy and paste the code as its own procedure.
This code is written in the DrawItem event. The first line of the code gives
you a clue:
Private Sub TabControl1_Dra wItem(....) Handles TabControl1.Dra wItem

if it was meant to be in the click event the first line would have read:
Private Sub TabControl1_Cli ck(....) Handles TabControl1.Cli ck

Maybe you were confused by the Line Continuation characters I used in order
that Outlook would not autowrap the text to 76 characters and spoil the
code.

Of course this code is dependant upon your TabControl being called
TabControl1.
There is no property available to change the appearance of the Text of an
individual Tab.
The code draws all the TabPage HeaderItems of TabControl1, making only the
selected TabPages Text Bold.
"Alexia" <s@d> wrote in message
news:00******** *************** *****@phx.gbl.. .
Hi Mick

where do i write this code? Does it go in the onclick
event for each tabpage?
does the actual tabpage title not have a bold function
that will work specifically for just that text and not
everything else on that page?

thx
-----Original Message-----
You'll have to set the TabControls DrawMode property to

OwnerDrawFixed and
draw the text in the TabControls DrawItem procedure.

VB.Net example:
\\\
Private Sub TabControl1_Dra wItem(ByVal sender As Object,

_
ByVal e As

System.Windows. Forms.DrawItemE ventArgs) _
Handles TabControl1.Dra wItem

Dim r As RectangleF = RectangleF.op_I mplicit(e.Bound s)
Dim ItemBrush As New SolidBrush(TabC ontrol1.BackCol or)
Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center
sf.LineAlignmen t = StringAlignment .Center

If CBool(e.State And DrawItemState.S elected) Then
e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)
e.Graphics.Draw String(TabContr ol1.TabPages

(e.Index).Text, _
New Font(e.Font,

FontStyle.Bold) , _
Brushes.Black, _
r, sf)
Else
e.Graphics.Draw String(TabContr ol1.TabPages

(e.Index).Text, _
e.Font, _
Brushes.Black, _
r, sf)
End If

End Sub
///
Note that if the Tabpage Font does not support

Fonstyle.Bold then the
function will fail. In this case use:
\\\
New Font(Font.FontF amily.GenericSa nsSerif, _
e.Font.SizeInPo ints, _
FontStyle.Bold, _
GraphicsUnit.Po int)
///
in place of:
New Font(e.Font, Fonstyle.Bold)

If you have XP Visual Styles then a lot more work is

required as you'll have
to PInvoke various uxtheme.dll Functions in order to

draw the TabPage Header
Items.
"Alexia" <s@d> wrote in message
news:09******* *************** ******@phx.gbl. ..
Hi,

I wanted to know how i can make the title that is
displayed in a tabpage bold when it is selected.
I have 4 tabpages and i want the user to know more
clearly which one is selected.

I tried to do this but for some reason all the text on
that particular page turns bold.
Can any one give me some pointers?

Thx in advance.
btw im using VB.NET

.

Jul 21 '05 #4
Hi Mick

i pasted the code that you provided me into my form. I
have a control named TabControl1 with 4 tabpages.
The problem i am having is that the application runs with
no build error but the text that appears in the tab does
not turn bold when i click on it.
Is there anything else i need to edit in your code before
i can use it?

thx in advance
-----Original Message-----
Just copy and paste the code as its own procedure.
This code is written in the DrawItem event. The first line of the code givesyou a clue:
Private Sub TabControl1_Dra wItem(....) Handles TabControl1.Dra wItem
if it was meant to be in the click event the first line would have read: Private Sub TabControl1_Cli ck(....) Handles TabControl1.Cli ck
Maybe you were confused by the Line Continuation characters I used in orderthat Outlook would not autowrap the text to 76 characters and spoil thecode.

Of course this code is dependant upon your TabControl being calledTabControl1.
There is no property available to change the appearance of the Text of anindividual Tab.
The code draws all the TabPage HeaderItems of TabControl1, making only theselected TabPages Text Bold.
"Alexia" <s@d> wrote in message
news:00******* *************** ******@phx.gbl. ..
Hi Mick

where do i write this code? Does it go in the onclick
event for each tabpage?
does the actual tabpage title not have a bold function
that will work specifically for just that text and not
everything else on that page?

thx
>-----Original Message-----
>You'll have to set the TabControls DrawMode property to
OwnerDrawFixed and
>draw the text in the TabControls DrawItem procedure.
>
>VB.Net example:
>\\\
>Private Sub TabControl1_Dra wItem(ByVal sender As
Object, _
> ByVal e As

System.Windows. Forms.DrawItemE ventArgs) _
> Handles TabControl1.Dra wItem
>
> Dim r As RectangleF = RectangleF.op_I mplicit
(e.Bounds) > Dim ItemBrush As New SolidBrush (TabControl1.Ba ckColor) > Dim sf As New StringFormat
>
> sf.Alignment = StringAlignment .Center
> sf.LineAlignmen t = StringAlignment .Center
>
> If CBool(e.State And DrawItemState.S elected) Then
> e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)
> e.Graphics.Draw String(TabContr ol1.TabPages

(e.Index).Text, _
> New Font (e.Font, FontStyle.Bold) , _
>

Brushes.Black, _ > r, sf)
> Else
> e.Graphics.Draw String(TabContr ol1.TabPages

(e.Index).Text, _
> e.Font, _
> Brushes.Black, _ > r, sf)
> End If
>
>End Sub
>///
>Note that if the Tabpage Font does not support

Fonstyle.Bold then the
>function will fail. In this case use:
>\\\
> New Font(Font.FontF amily.GenericSa nsSerif, _
> e.Font.SizeInPo ints, _
> FontStyle.Bold, _
> GraphicsUnit.Po int)
>///
>in place of:
> New Font(e.Font, Fonstyle.Bold)
>
>If you have XP Visual Styles then a lot more work is

required as you'll have
>to PInvoke various uxtheme.dll Functions in order to

draw the TabPage Header
>Items.
>
>
>"Alexia" <s@d> wrote in message
>news:09******* *************** ******@phx.gbl. ..
>> Hi,
>>
>> I wanted to know how i can make the title that is
>> displayed in a tabpage bold when it is selected.
>> I have 4 tabpages and i want the user to know more
>> clearly which one is selected.
>>
>> I tried to do this but for some reason all the text on >> that particular page turns bold.
>> Can any one give me some pointers?
>>
>> Thx in advance.
>>
>>
>> btw im using VB.NET
>>
>
>
>.
>

.

Jul 21 '05 #5
Hi Mick

thx for the code. it worked a treat. I just forgot to set
the Drawmode property to OwnerDrawFixed and that is whyi
couldnt get it to work.

Do u know of a way to change the background colour of the
tabpage when the relavant tab is selected?
-----Original Message-----
Hi Mick

i pasted the code that you provided me into my form. I
have a control named TabControl1 with 4 tabpages.
The problem i am having is that the application runs withno build error but the text that appears in the tab does
not turn bold when i click on it.
Is there anything else i need to edit in your code beforei can use it?

thx in advance
-----Original Message-----
Just copy and paste the code as its own procedure.
This code is written in the DrawItem event. The firstline of the code gives
you a clue:
Private Sub TabControl1_Dra wItem(....) Handles

TabControl1.Dr awItem

if it was meant to be in the click event the first line

would have read:
Private Sub TabControl1_Cli ck(....) Handles

TabControl1.Cl ick

Maybe you were confused by the Line Continuation

characters I used in order
that Outlook would not autowrap the text to 76

characters and spoil the
code.

Of course this code is dependant upon your TabControl

being called
TabControl1 .
There is no property available to change the appearance

of the Text of an
individual Tab.
The code draws all the TabPage HeaderItems of

TabControl1, making only the
selected TabPages Text Bold.
"Alexia" <s@d> wrote in message
news:00****** *************** *******@phx.gbl ...
Hi Mick

where do i write this code? Does it go in the onclick
event for each tabpage?
does the actual tabpage title not have a bold function
that will work specifically for just that text and not
everything else on that page?

thx

>-----Original Message-----
>You'll have to set the TabControls DrawMode propertyto OwnerDrawFixed and
>draw the text in the TabControls DrawItem procedure.
>
>VB.Net example:
>\\\
>Private Sub TabControl1_Dra wItem(ByVal sender AsObject, _
> ByVal e As
System.Windows. Forms.DrawItemE ventArgs) _
> Handles TabControl1.Dra wItem
>
> Dim r As RectangleF = RectangleF.op_I mplicit(e.Bounds) > Dim ItemBrush As New SolidBrush(TabControl1.B ackColor) > Dim sf As New StringFormat
>
> sf.Alignment = StringAlignment .Center
> sf.LineAlignmen t = StringAlignment .Center
>
> If CBool(e.State And DrawItemState.S elected) Then
> e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)
> e.Graphics.Draw String(TabContr ol1.TabPages
(e.Index).Text, _
> New Font(e.Font, FontStyle.Bold) , _
>Brushes.Blac k, _ > r, sf)
> Else
> e.Graphics.Draw String(TabContr ol1.TabPages
(e.Index).Text, _
> e.Font, _
>Brushes.Blac k, _ > r, sf)
> End If
>
>End Sub
>///
>Note that if the Tabpage Font does not support
Fonstyle.Bold then the
>function will fail. In this case use:
>\\\
> New Font(Font.FontF amily.GenericSa nsSerif, _
> e.Font.SizeInPo ints, _
> FontStyle.Bold, _
> GraphicsUnit.Po int)
>///
>in place of:
> New Font(e.Font, Fonstyle.Bold)
>
>If you have XP Visual Styles then a lot more work is
required as you'll have
>to PInvoke various uxtheme.dll Functions in order to
draw the TabPage Header
>Items.
>
>
>"Alexia" <s@d> wrote in message
>news:09******* *************** ******@phx.gbl. ..
>> Hi,
>>
>> I wanted to know how i can make the title that is
>> displayed in a tabpage bold when it is selected.
>> I have 4 tabpages and i want the user to know more
>> clearly which one is selected.
>>
>> I tried to do this but for some reason all the
texton >> that particular page turns bold.
>> Can any one give me some pointers?
>>
>> Thx in advance.
>>
>>
>> btw im using VB.NET
>>
>
>
>.
>

.

.

Jul 21 '05 #6
Change the color of the ItemBrush. At the moment it is declared as:
Dim ItemBrush As New SolidBrush(TabC ontrol1.BackCol or)
Change that to:
Dim ItemBrush As New SolidBrush(Colo r.WhateverYouLi ke)

If you also want a custom color for the Non Selected items then add the
following two lines between Else and e.Graphics.Draw String(... :
ItemBrush.Color = Color.SomeOther Color
e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)

Obviously Color.WhateverY ouLike and Color.SomeOther Color wont work, but
hopefully you understand that.

"Alexia" <an*******@disc ussions.microso ft.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
Hi Mick

thx for the code. it worked a treat. I just forgot to set
the Drawmode property to OwnerDrawFixed and that is whyi
couldnt get it to work.

Do u know of a way to change the background colour of the
tabpage when the relavant tab is selected?
-----Original Message-----
Hi Mick

i pasted the code that you provided me into my form. I
have a control named TabControl1 with 4 tabpages.
The problem i am having is that the application runs

with
no build error but the text that appears in the tab does
not turn bold when i click on it.
Is there anything else i need to edit in your code

before
i can use it?

thx in advance
-----Original Message-----
Just copy and paste the code as its own procedure.
This code is written in the DrawItem event. The first

line of the code gives
you a clue:
Private Sub TabControl1_Dra wItem(....) Handles

TabControl1.Dr awItem

if it was meant to be in the click event the first line

would have read:
Private Sub TabControl1_Cli ck(....) Handles

TabControl1.Cl ick

Maybe you were confused by the Line Continuation

characters I used in order
that Outlook would not autowrap the text to 76

characters and spoil the
code.

Of course this code is dependant upon your TabControl

being called
TabControl1 .
There is no property available to change the appearance

of the Text of an
individual Tab.
The code draws all the TabPage HeaderItems of

TabControl1, making only the
selected TabPages Text Bold.
"Alexia" <s@d> wrote in message
news:00****** *************** *******@phx.gbl ...
Hi Mick

where do i write this code? Does it go in the onclick
event for each tabpage?
does the actual tabpage title not have a bold function
that will work specifically for just that text and not
everything else on that page?

thx

>-----Original Message-----
>You'll have to set the TabControls DrawMode property

to
OwnerDrawFixed and
>draw the text in the TabControls DrawItem procedure.
>
>VB.Net example:
>\\\
>Private Sub TabControl1_Dra wItem(ByVal sender As

Object,
_
> ByVal e As
System.Windows. Forms.DrawItemE ventArgs) _
> Handles TabControl1.Dra wItem
>
> Dim r As RectangleF = RectangleF.op_I mplicit

(e.Bounds)
> Dim ItemBrush As New SolidBrush

(TabControl1.B ackColor)
> Dim sf As New StringFormat
>
> sf.Alignment = StringAlignment .Center
> sf.LineAlignmen t = StringAlignment .Center
>
> If CBool(e.State And DrawItemState.S elected) Then
> e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)
> e.Graphics.Draw String(TabContr ol1.TabPages
(e.Index).Text, _
> New Font

(e.Font,
FontStyle.Bold) , _
>

Brushes.Blac k, _
> r, sf)
> Else
> e.Graphics.Draw String(TabContr ol1.TabPages
(e.Index).Text, _
> e.Font, _
>

Brushes.Blac k, _
> r, sf)
> End If
>
>End Sub
>///
>Note that if the Tabpage Font does not support
Fonstyle.Bold then the
>function will fail. In this case use:
>\\\
> New Font(Font.FontF amily.GenericSa nsSerif, _
> e.Font.SizeInPo ints, _
> FontStyle.Bold, _
> GraphicsUnit.Po int)
>///
>in place of:
> New Font(e.Font, Fonstyle.Bold)
>
>If you have XP Visual Styles then a lot more work is
required as you'll have
>to PInvoke various uxtheme.dll Functions in order to
draw the TabPage Header
>Items.
>
>
>"Alexia" <s@d> wrote in message
>news:09******* *************** ******@phx.gbl. ..
>> Hi,
>>
>> I wanted to know how i can make the title that is
>> displayed in a tabpage bold when it is selected.
>> I have 4 tabpages and i want the user to know more
>> clearly which one is selected.
>>
>> I tried to do this but for some reason all the

text
on
>> that particular page turns bold.
>> Can any one give me some pointers?
>>
>> Thx in advance.
>>
>>
>> btw im using VB.NET
>>
>
>
>.
>
.

.

Jul 21 '05 #7
PK
Hi,
I want similar functionality, but in some other button. My application
has
4 tab pages. In the final page we have review button where we do
validations
for all input. If some errors are found in particular tab page, we
want that
tab text to turn red. Errors we are finding from database or
whereever. we know
that which page has errors. But how to turn that particular tab to red
when button is clicked.

I would appreciate your response.

Thanks
PK


"Mick Doherty" <EX***********@ AND.REMOVE.SQUA REBRACKETS.[mdaudi100#ntlwo rld.com]> wrote in message news:<e1******* *******@tk2msft ngp13.phx.gbl>. ..
Change the color of the ItemBrush. At the moment it is declared as:
Dim ItemBrush As New SolidBrush(TabC ontrol1.BackCol or)
Change that to:
Dim ItemBrush As New SolidBrush(Colo r.WhateverYouLi ke)

If you also want a custom color for the Non Selected items then add the
following two lines between Else and e.Graphics.Draw String(... :
ItemBrush.Color = Color.SomeOther Color
e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)

Obviously Color.WhateverY ouLike and Color.SomeOther Color wont work, but
hopefully you understand that.

"Alexia" <an*******@disc ussions.microso ft.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
Hi Mick

thx for the code. it worked a treat. I just forgot to set
the Drawmode property to OwnerDrawFixed and that is whyi
couldnt get it to work.

Do u know of a way to change the background colour of the
tabpage when the relavant tab is selected?
-----Original Message-----
Hi Mick

i pasted the code that you provided me into my form. I
have a control named TabControl1 with 4 tabpages.
The problem i am having is that the application runs withno build error but the text that appears in the tab does
not turn bold when i click on it.
Is there anything else i need to edit in your code beforei can use it?

thx in advance

>-----Original Message-----
>Just copy and paste the code as its own procedure.
>This code is written in the DrawItem event. The first line of the code gives>you a clue:
> Private Sub TabControl1_Dra wItem(....) Handles TabControl1.Dra wItem>
>if it was meant to be in the click event the first line would have read:> Private Sub TabControl1_Cli ck(....) Handles TabControl1.Cli ck>
>Maybe you were confused by the Line Continuation characters I used in order>that Outlook would not autowrap the text to 76 characters and spoil the>code.
>
>Of course this code is dependant upon your TabControl being called>TabControl1 .
>There is no property available to change the appearance of the Text of an>individual Tab.
>The code draws all the TabPage HeaderItems of TabControl1, making only the>selected TabPages Text Bold.
>
>
>"Alexia" <s@d> wrote in message
>news:00****** *************** *******@phx.gbl ...
>> Hi Mick
>>
>> where do i write this code? Does it go in the onclick
>> event for each tabpage?
>> does the actual tabpage title not have a bold function
>> that will work specifically for just that text and not
>> everything else on that page?
>>
>> thx
>>
>> >-----Original Message-----
>> >You'll have to set the TabControls DrawMode property to
OwnerDrawFixed and>> >draw the text in the TabControls DrawItem procedure.
>> >
>> >VB.Net example:
>> >\\\
>> >Private Sub TabControl1_Dra wItem(ByVal sender As Object,
_>> > ByVal e As System.Windows. Forms.DrawItemE ventArgs) _>> > Handles TabControl1.Dra wItem
>> >
>> > Dim r As RectangleF = RectangleF.op_I mplicit (e.Bounds)>> > Dim ItemBrush As New SolidBrush (TabControl1.Ba ckColor)>> > Dim sf As New StringFormat
>> >
>> > sf.Alignment = StringAlignment .Center
>> > sf.LineAlignmen t = StringAlignment .Center
>> >
>> > If CBool(e.State And DrawItemState.S elected) Then
>> > e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)
>> > e.Graphics.Draw String(TabContr ol1.TabPages (e.Index).Text, _>> > New Font (e.Font,
FontStyle.Bold) , _>> > Brushes.Black, _>> > r, sf)
>> > Else
>> > e.Graphics.Draw String(TabContr ol1.TabPages (e.Index).Text, _>> > e.Font, _
>> > Brushes.Black, _>> > r, sf)
>> > End If
>> >
>> >End Sub
>> >///
>> >Note that if the Tabpage Font does not support Fonstyle.Bold then the>> >function will fail. In this case use:
>> >\\\
>> > New Font(Font.FontF amily.GenericSa nsSerif, _
>> > e.Font.SizeInPo ints, _
>> > FontStyle.Bold, _
>> > GraphicsUnit.Po int)
>> >///
>> >in place of:
>> > New Font(e.Font, Fonstyle.Bold)
>> >
>> >If you have XP Visual Styles then a lot more work is required as you'll have>> >to PInvoke various uxtheme.dll Functions in order to draw the TabPage Header>> >Items.
>> >
>> >
>> >"Alexia" <s@d> wrote in message
>> >news:09******* *************** ******@phx.gbl. ..
>> >> Hi,
>> >>
>> >> I wanted to know how i can make the title that is
>> >> displayed in a tabpage bold when it is selected.
>> >> I have 4 tabpages and i want the user to know more
>> >> clearly which one is selected.
>> >>
>> >> I tried to do this but for some reason all the text
on>> >> that particular page turns bold.
>> >> Can any one give me some pointers?
>> >>
>> >> Thx in advance.
>> >>
>> >>
>> >> btw im using VB.NET
>> >>
>> >
>> >
>> >.
>> >
>
>
>.
>
.

Jul 21 '05 #8
Hope you can make sense of this:

\\\
Private TabPageInvalid( ) As Boolean.

Private Sub Form_Load(...). ..
Redim TabPageInvalid( TabControl1.Tab Pages.Count-1)
End Sub

Private Sub ValidationButto n_Click(...)...
For each tp As TabPage in TabControl1.Tab Pages
If tp is not validated by your checks then
TabPageInvalid( tp.TabIndex) = True
End If
Next
TabControl1.Inv alidate()
End Sub

Private Sub TabControl1_Dra wItem(ByVal sender As Object, _
ByVal e As System.Windows. Forms.DrawItemE ventArgs) _
Handles TabControl1.Dra wItem

Dim r As RectangleF = RectangleF.op_I mplicit(e.Bound s)
Dim ItemBrush As New SolidBrush(TabC ontrol1.BackCol or)
Dim sf As New StringFormat

sf.Alignment = StringAlignment .Center
sf.LineAlignmen t = StringAlignment .Center

e.Graphics.Fill Rectangle(ItemB rush, e.Bounds)

If TabPageInvalid( e.Index) Then
e.Graphics.Draw String(TabContr ol1.TabPages(e. Index).Text, _
e.Font, _
Brushes.Red, _
r, sf)
Else
e.Graphics.Draw String(TabContr ol1.TabPages(e. Index).Text, _
e.Font, _
SystemBrushes.C ontrolText, _
r, sf)
End If

End Sub
///
"PK" <pr************ @hydrochem.com> wrote in message
news:61******** *************** **@posting.goog le.com...
Hi,
I want similar functionality, but in some other button. My application
has
4 tab pages. In the final page we have review button where we do
validations
for all input. If some errors are found in particular tab page, we
want that
tab text to turn red. Errors we are finding from database or
whereever. we know
that which page has errors. But how to turn that particular tab to red
when button is clicked.

I would appreciate your response.

Thanks
PK

Jul 21 '05 #9

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

Similar topics

0
1075
by: Thanos | last post by:
Hi everybody. Excuse my english is not perfect. I would to hide TabPages but I have tried >> TabPage.hide() or >> TabPage.Visible = False but no luck. Maybe the current Tab control doesn't support hiding/unhiding
4
5949
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a single RichTextBox on each page. In my controls loaded event I call my Render() method which configures everything appropriately. When setting up the TabControl the first thing it says is (not real var names):
1
2741
by: Luc | last post by:
Hi, I have a TabControl and, at runtime, I need to add some tabpages. The problem is that each tabpage is similar to the others and contains several controls. If I do TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is added. How can I add in few statements a new tabpage as well as its controls (textboxes, labels, etc.)? The first tabpage (that I create at design time) is the "template" to be used for the other tabpages. Is...
3
4867
by: VJ | last post by:
Is there a way to Order Tabpages.. I tried to Use a Class that implements the IComparer and a Compare method as suggested in the MSDN article. "ArrayList.Sort()" and then use the instance of this class to sort like.. tbControl.TabPages.Sort(lstSorter) There seems to be no effect..... I have tried debugging, the sorting seems to happen, but Tabpages don't get rearranged. I even tried Referesh(),
7
3586
by: Richard | last post by:
I have a form with seven tapages. These span only one record with a large number of fields (textboxes). On Tabpage1 I display a number of read-only text boxes. This displays information about a particular Seller and is read from a SellerDataview at form load. On Tabpages 2-7, the information comes from another table/another DealDataview.
8
418
by: Alexia | last post by:
Hi, I wanted to know how i can make the title that is displayed in a tabpage bold when it is selected. I have 4 tabpages and i want the user to know more clearly which one is selected. I tried to do this but for some reason all the text on that particular page turns bold. Can any one give me some pointers?
2
1697
by: Kevin | last post by:
Although lots of people described how to workaround the lack of ability to hide and show tab pages on a tab control, I couldnt find a code example so I made one. Create a class that inherits from the tabcontrol and then add the following Private htVisibleVal As New Hashtable Private htVisibleKey As New Hashtable Private htInvisibleKey As New Hashtable 'stores the current tabpages
11
18156
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with ListView columns so it should be doable, thanks
7
5585
by: davidpryce123 | last post by:
Dear Windows Form Designers I am developing an application that uses a TabControl with several Tabpages. On the different Tabpages I wish to allow users to have the access to the same controls for instance a textbox to enter a date and time string for search.
0
10599
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
10346
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10347
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
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
9173
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
7635
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...
1
4308
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
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.