Gray-out the text on the tab control display? | | |
I would like to control entry into one or more of the tabs[color=blue]
> I have set up on my Tab control based on set rules. Does
> anyone know how to grey-out the text so that a user will
> see that they do not have access to that particular tab?
>
> I tried setting the enabled = false for the given tab,[/color]
but[color=blue]
> it only seems to work in the form assembly section (that
> is, if I do it after the form is loaded through a
> function, it doesn't seem to work), and doing that
> disables the controls on the tab, but does not grey out
> the text of the tab display itself.
>
> Thanks
>
> K[/color] | | | | re: Gray-out the text on the tab control display?
I assume you don't know before loading the form which to enable/disable? If
so a contructor passed a tabindex would work fine.
I also assume that you have tried setting the enabled property for the
particular tab page that you want disabled...
Is this true?
Shane
"KMiller" <anonymous@discussions.microsoft.com> wrote in message
news:05e801c3d94b$eed72e80$a101280a@phx.gbl...[color=blue]
> I would like to control entry into one or more of the tabs[color=green]
> > I have set up on my Tab control based on set rules. Does
> > anyone know how to grey-out the text so that a user will
> > see that they do not have access to that particular tab?
> >
> > I tried setting the enabled = false for the given tab,[/color]
> but[color=green]
> > it only seems to work in the form assembly section (that
> > is, if I do it after the form is loaded through a
> > function, it doesn't seem to work), and doing that
> > disables the controls on the tab, but does not grey out
> > the text of the tab display itself.
> >
> > Thanks
> >
> > K[/color]
>[/color] | | | | re: Gray-out the text on the tab control display?
At the time the form is assembled, I DO NOT know.
However, shortly thereafter (during the loading process),
I DO know whether they have access or not to the
particular tab. It's at this time when I'm attempting to
disable (gray-out) the tab text, but nothing works.
I've tried setting the enabled property to false for the
tab, but doing that does nothing to the tab text display,
and users have no way of knowing they DO NOT have access
to the tab other then by clicking into it and finding out
that nothing works because all the controls have been
disabled. Leaving the functionality this way is
inadequate and out of spec.
[color=blue]
>-----Original Message-----
>I assume you don't know before loading the form which to[/color]
enable/disable? If[color=blue]
>so a contructor passed a tabindex would work fine.
>
>I also assume that you have tried setting the enabled[/color]
property for the[color=blue]
>particular tab page that you want disabled...
>
>Is this true?
>
>Shane
>"KMiller" <anonymous@discussions.microsoft.com> wrote in[/color]
message[color=blue]
>news:05e801c3d94b$eed72e80$a101280a@phx.gbl...[color=green]
>> I would like to control entry into one or more of the[/color][/color]
tabs[color=blue][color=green][color=darkred]
>> > I have set up on my Tab control based on set rules.[/color][/color][/color]
Does[color=blue][color=green][color=darkred]
>> > anyone know how to grey-out the text so that a user[/color][/color][/color]
will[color=blue][color=green][color=darkred]
>> > see that they do not have access to that particular[/color][/color][/color]
tab?[color=blue][color=green][color=darkred]
>> >
>> > I tried setting the enabled = false for the given tab,[/color]
>> but[color=darkred]
>> > it only seems to work in the form assembly section[/color][/color][/color]
(that[color=blue][color=green][color=darkred]
>> > is, if I do it after the form is loaded through a
>> > function, it doesn't seem to work), and doing that
>> > disables the controls on the tab, but does not grey[/color][/color][/color]
out[color=blue][color=green][color=darkred]
>> > the text of the tab display itself.
>> >
>> > Thanks
>> >
>> > K[/color]
>>[/color]
>
>
>.
>[/color] | | | | re: Gray-out the text on the tab control display?
Hi K,
wow, I see your point.
I thought I had it fixed in my app too but my titles aren't disabled either.
You can do ownerdrawn fixed and change the color of the font easy enough.
Private Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As
System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
Dim tp As TabPage
Dim layoutrct As New RectangleF(e.Bounds.Left, e.Bounds.Top,
e.Bounds.Width, e.Bounds.Height)
Dim sf As New StringFormat(StringFormatFlags.FitBlackBox)
sf.Alignment = StringAlignment.Center
sf.LineAlignment = StringAlignment.Center
tp = TabControl1.TabPages(e.Index)
If Not tp.Enabled Then
'for some reason not printing the 3-d part--tried to print twice
with offset but no luck
e.Graphics.DrawString(tp.Text, e.Font, SystemBrushes.ControlLight,
layoutrct)
layoutrct.Offset(2, 2)
e.Graphics.DrawString(tp.Text, e.Font, SystemBrushes.ControlDark,
layoutrct) 'SolidBrush(e.BackColor), layoutrct)
Else
e.Graphics.DrawString(tp.Text, e.Font,New SolidBrush(e.BackColor),
layoutrct)
End If
End Sub
This works if items are not enabled. But there must be an easier way--also
they shouldn't even be able to click on the tab.
I haven't found out how to avoid that.
this is a really big pain for something simple--but it seems that most of
the control included are lacking in very bacic features and require lots of
extra coding to just do standard things.
I hope you find an answer--I would also like to know.
Shane
"KMiller" <anonymous@discussions.microsoft.com> wrote in message
news:00c601c3d9f4$1ea7d8f0$a301280a@phx.gbl...[color=blue]
> At the time the form is assembled, I DO NOT know.
> However, shortly thereafter (during the loading process),
> I DO know whether they have access or not to the
> particular tab. It's at this time when I'm attempting to
> disable (gray-out) the tab text, but nothing works.
>
> I've tried setting the enabled property to false for the
> tab, but doing that does nothing to the tab text display,
> and users have no way of knowing they DO NOT have access
> to the tab other then by clicking into it and finding out
> that nothing works because all the controls have been
> disabled. Leaving the functionality this way is
> inadequate and out of spec.
>
>[color=green]
> >-----Original Message-----
> >I assume you don't know before loading the form which to[/color]
> enable/disable? If[color=green]
> >so a contructor passed a tabindex would work fine.
> >
> >I also assume that you have tried setting the enabled[/color]
> property for the[color=green]
> >particular tab page that you want disabled...
> >
> >Is this true?
> >
> >Shane
> >"KMiller" <anonymous@discussions.microsoft.com> wrote in[/color]
> message[color=green]
> >news:05e801c3d94b$eed72e80$a101280a@phx.gbl...[color=darkred]
> >> I would like to control entry into one or more of the[/color][/color]
> tabs[color=green][color=darkred]
> >> > I have set up on my Tab control based on set rules.[/color][/color]
> Does[color=green][color=darkred]
> >> > anyone know how to grey-out the text so that a user[/color][/color]
> will[color=green][color=darkred]
> >> > see that they do not have access to that particular[/color][/color]
> tab?[color=green][color=darkred]
> >> >
> >> > I tried setting the enabled = false for the given tab,
> >> but
> >> > it only seems to work in the form assembly section[/color][/color]
> (that[color=green][color=darkred]
> >> > is, if I do it after the form is loaded through a
> >> > function, it doesn't seem to work), and doing that
> >> > disables the controls on the tab, but does not grey[/color][/color]
> out[color=green][color=darkred]
> >> > the text of the tab display itself.
> >> >
> >> > Thanks
> >> >
> >> > K
> >>[/color]
> >
> >
> >.
> >[/color][/color] | | | | re: Gray-out the text on the tab control display?
You'll have to OwnerDraw the Tabs if that's the appearance you want.
Why not simply remove the Tabpages that the user has no access to?
"KMiller" <anonymous@discussions.microsoft.com> wrote in message
news:00c601c3d9f4$1ea7d8f0$a301280a@phx.gbl...[color=blue]
> At the time the form is assembled, I DO NOT know.
> However, shortly thereafter (during the loading process),
> I DO know whether they have access or not to the
> particular tab. It's at this time when I'm attempting to
> disable (gray-out) the tab text, but nothing works.
>
> I've tried setting the enabled property to false for the
> tab, but doing that does nothing to the tab text display,
> and users have no way of knowing they DO NOT have access
> to the tab other then by clicking into it and finding out
> that nothing works because all the controls have been
> disabled. Leaving the functionality this way is
> inadequate and out of spec.
>
>[color=green]
> >-----Original Message-----
> >I assume you don't know before loading the form which to[/color]
> enable/disable? If[color=green]
> >so a contructor passed a tabindex would work fine.
> >
> >I also assume that you have tried setting the enabled[/color]
> property for the[color=green]
> >particular tab page that you want disabled...
> >
> >Is this true?
> >
> >Shane
> >"KMiller" <anonymous@discussions.microsoft.com> wrote in[/color]
> message[color=green]
> >news:05e801c3d94b$eed72e80$a101280a@phx.gbl...[color=darkred]
> >> I would like to control entry into one or more of the[/color][/color]
> tabs[color=green][color=darkred]
> >> > I have set up on my Tab control based on set rules.[/color][/color]
> Does[color=green][color=darkred]
> >> > anyone know how to grey-out the text so that a user[/color][/color]
> will[color=green][color=darkred]
> >> > see that they do not have access to that particular[/color][/color]
> tab?[color=green][color=darkred]
> >> >
> >> > I tried setting the enabled = false for the given tab,
> >> but
> >> > it only seems to work in the form assembly section[/color][/color]
> (that[color=green][color=darkred]
> >> > is, if I do it after the form is loaded through a
> >> > function, it doesn't seem to work), and doing that
> >> > disables the controls on the tab, but does not grey[/color][/color]
> out[color=green][color=darkred]
> >> > the text of the tab display itself.
> >> >
> >> > Thanks
> >> >
> >> > K
> >>[/color]
> >
> >
> >.
> >[/color][/color] | | | | re: Gray-out the text on the tab control display?
Mick,
I told her the same thing, but how do you draw them with the normal 3d
enabled look?
I tried drawstring using a layout rect and then offset(1,1) or offset(2,2)
on it and drew again using the same with a different color but it doesn't
work.
Also,
disabled means you shouldn't even be able to select the tab in the first
place. How can this be accomplished?
Thanks,
Shane
"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:ua3JCDg2DHA.308@TK2MSFTNGP11.phx.gbl...[color=blue]
> You'll have to OwnerDraw the Tabs if that's the appearance you want.
> Why not simply remove the Tabpages that the user has no access to?
>
> "KMiller" <anonymous@discussions.microsoft.com> wrote in message
> news:00c601c3d9f4$1ea7d8f0$a301280a@phx.gbl...[color=green]
> > At the time the form is assembled, I DO NOT know.
> > However, shortly thereafter (during the loading process),
> > I DO know whether they have access or not to the
> > particular tab. It's at this time when I'm attempting to
> > disable (gray-out) the tab text, but nothing works.
> >
> > I've tried setting the enabled property to false for the
> > tab, but doing that does nothing to the tab text display,
> > and users have no way of knowing they DO NOT have access
> > to the tab other then by clicking into it and finding out
> > that nothing works because all the controls have been
> > disabled. Leaving the functionality this way is
> > inadequate and out of spec.
> >
> >[color=darkred]
> > >-----Original Message-----
> > >I assume you don't know before loading the form which to[/color]
> > enable/disable? If[color=darkred]
> > >so a contructor passed a tabindex would work fine.
> > >
> > >I also assume that you have tried setting the enabled[/color]
> > property for the[color=darkred]
> > >particular tab page that you want disabled...
> > >
> > >Is this true?
> > >
> > >Shane
> > >"KMiller" <anonymous@discussions.microsoft.com> wrote in[/color]
> > message[color=darkred]
> > >news:05e801c3d94b$eed72e80$a101280a@phx.gbl...
> > >> I would like to control entry into one or more of the[/color]
> > tabs[color=darkred]
> > >> > I have set up on my Tab control based on set rules.[/color]
> > Does[color=darkred]
> > >> > anyone know how to grey-out the text so that a user[/color]
> > will[color=darkred]
> > >> > see that they do not have access to that particular[/color]
> > tab?[color=darkred]
> > >> >
> > >> > I tried setting the enabled = false for the given tab,
> > >> but
> > >> > it only seems to work in the form assembly section[/color]
> > (that[color=darkred]
> > >> > is, if I do it after the form is loaded through a
> > >> > function, it doesn't seem to work), and doing that
> > >> > disables the controls on the tab, but does not grey[/color]
> > out[color=darkred]
> > >> > the text of the tab display itself.
> > >> >
> > >> > Thanks
> > >> >
> > >> > K
> > >>
> > >
> > >
> > >.
> > >[/color][/color]
>
>[/color] | | | | re: Gray-out the text on the tab control display?
Thanks for the responses to all..
Seems like a lot of trouble to execute a very simple
change. We purchases the Infragistics UltraDev suite a
while back, which includes a tab control, but we had not
been using it. I just checked it out and sure enough, it
grays-out the text by simply disabling the tab. I may
just swap out by MS tab for this one.
K
[color=blue]
>-----Original Message-----
>Hi K,
>
>wow, I see your point.
>
>I thought I had it fixed in my app too but my titles[/color]
aren't disabled either.[color=blue]
>
>You can do ownerdrawn fixed and change the color of the[/color]
font easy enough.[color=blue]
>
>Private Sub TabControl1_DrawItem(ByVal sender As Object,[/color]
ByVal e As[color=blue]
>System.Windows.Forms.DrawItemEventArgs) Handles[/color]
TabControl1.DrawItem[color=blue]
> Dim tp As TabPage
> Dim layoutrct As New RectangleF(e.Bounds.Left,[/color]
e.Bounds.Top,[color=blue]
>e.Bounds.Width, e.Bounds.Height)
> Dim sf As New StringFormat[/color]
(StringFormatFlags.FitBlackBox)[color=blue]
> sf.Alignment = StringAlignment.Center
> sf.LineAlignment = StringAlignment.Center
>
> tp = TabControl1.TabPages(e.Index)
> If Not tp.Enabled Then
> 'for some reason not printing the 3-d part--tried[/color]
to print twice[color=blue]
>with offset but no luck
> e.Graphics.DrawString(tp.Text, e.Font,[/color]
SystemBrushes.ControlLight,[color=blue]
>layoutrct)
> layoutrct.Offset(2, 2)
> e.Graphics.DrawString(tp.Text, e.Font,[/color]
SystemBrushes.ControlDark,[color=blue]
>layoutrct) 'SolidBrush(e.BackColor), layoutrct)
> Else
> e.Graphics.DrawString(tp.Text, e.Font,New[/color]
SolidBrush(e.BackColor),[color=blue]
>layoutrct)
> End If
>End Sub
>
>This works if items are not enabled. But there must be[/color]
an easier way--also[color=blue]
>they shouldn't even be able to click on the tab.
>
>I haven't found out how to avoid that.
>
>this is a really big pain for something simple--but it[/color]
seems that most of[color=blue]
>the control included are lacking in very bacic features[/color]
and require lots of[color=blue]
>extra coding to just do standard things.
>
>I hope you find an answer--I would also like to know.
>
>Shane
>
>
>"KMiller" <anonymous@discussions.microsoft.com> wrote in[/color]
message[color=blue]
>news:00c601c3d9f4$1ea7d8f0$a301280a@phx.gbl...[color=green]
>> At the time the form is assembled, I DO NOT know.
>> However, shortly thereafter (during the loading[/color][/color]
process),[color=blue][color=green]
>> I DO know whether they have access or not to the
>> particular tab. It's at this time when I'm attempting[/color][/color]
to[color=blue][color=green]
>> disable (gray-out) the tab text, but nothing works.
>>
>> I've tried setting the enabled property to false for the
>> tab, but doing that does nothing to the tab text[/color][/color]
display,[color=blue][color=green]
>> and users have no way of knowing they DO NOT have access
>> to the tab other then by clicking into it and finding[/color][/color]
out[color=blue][color=green]
>> that nothing works because all the controls have been
>> disabled. Leaving the functionality this way is
>> inadequate and out of spec.
>>
>>[color=darkred]
>> >-----Original Message-----
>> >I assume you don't know before loading the form which[/color][/color][/color]
to[color=blue][color=green]
>> enable/disable? If[color=darkred]
>> >so a contructor passed a tabindex would work fine.
>> >
>> >I also assume that you have tried setting the enabled[/color]
>> property for the[color=darkred]
>> >particular tab page that you want disabled...
>> >
>> >Is this true?
>> >
>> >Shane
>> >"KMiller" <anonymous@discussions.microsoft.com> wrote[/color][/color][/color]
in[color=blue][color=green]
>> message[color=darkred]
>> >news:05e801c3d94b$eed72e80$a101280a@phx.gbl...
>> >> I would like to control entry into one or more of the[/color]
>> tabs[color=darkred]
>> >> > I have set up on my Tab control based on set rules.[/color]
>> Does[color=darkred]
>> >> > anyone know how to grey-out the text so that a user[/color]
>> will[color=darkred]
>> >> > see that they do not have access to that particular[/color]
>> tab?[color=darkred]
>> >> >
>> >> > I tried setting the enabled = false for the given[/color][/color][/color]
tab,[color=blue][color=green][color=darkred]
>> >> but
>> >> > it only seems to work in the form assembly section[/color]
>> (that[color=darkred]
>> >> > is, if I do it after the form is loaded through a
>> >> > function, it doesn't seem to work), and doing that
>> >> > disables the controls on the tab, but does not grey[/color]
>> out[color=darkred]
>> >> > the text of the tab display itself.
>> >> >
>> >> > Thanks
>> >> >
>> >> > K
>> >>
>> >
>> >
>> >.
>> >[/color][/color]
>
>
>.
>[/color] | | | | re: Gray-out the text on the tab control display?
Your reply was close. Use ControlPaint.DrawStringDisabled() not
Graphics.DrawString() twice.
As for not being able to select Disabled Tabpages, that can be emulated,
although I feel it is better to remove the TabPage than display it as
Disabled.
Code follows:
\\\
Private ValidPageIndex As Integer = 0
Private Sub TabControl1_DrawItem(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DrawItemEventArgs) _
Handles TabControl1.DrawItem
Dim CurrentTabPage As TabPage = TabControl1.TabPages(e.Index)
Dim r As RectangleF = RectangleF.op_Implicit(e.Bounds)
Dim ItemBrush As New SolidBrush(TabControl1.BackColor)
Dim TextBrush As New SolidBrush(TabControl1.ForeColor)
Dim sf As New StringFormat
sf.Alignment = StringAlignment.Center
sf.LineAlignment = StringAlignment.Center
e.Graphics.FillRectangle(ItemBrush, e.Bounds)
If CurrentTabPage.Enabled = False Then
ControlPaint.DrawStringDisabled(e.Graphics, _
CurrentTabPage.Text, _
e.Font, _
ItemBrush.Color, _
r, sf)
Else
e.Graphics.DrawString(CurrentTabPage.Text, _
e.Font, _
TextBrush, _
r, sf)
End If
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles TabControl1.SelectedIndexChanged
If TabControl1.SelectedTab.Enabled = False Then
TabControl1.SelectedIndex = ValidPageIndex
Else
ValidPageIndex = TabControl1.SelectedIndex
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
TabPage2.Enabled = False
End Sub
///
"SStory" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:uZDMuIg2DHA.2180@TK2MSFTNGP12.phx.gbl...[color=blue]
> Mick,
>
> I told her the same thing, but how do you draw them with the normal 3d
> enabled look?
>
> I tried drawstring using a layout rect and then offset(1,1) or offset(2,2)
> on it and drew again using the same with a different color but it doesn't
> work.
>
> Also,
> disabled means you shouldn't even be able to select the tab in the first
> place. How can this be accomplished?
>
> Thanks,
>
> Shane
>[/color] | | | | re: Gray-out the text on the tab control display?
cool, never have noticed that method.
This should have been implemented in the control to begin with.
Thanks,
Shane
"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:egk%23Dtg2DHA.2548@tk2msftngp13.phx.gbl...[color=blue]
> Your reply was close. Use ControlPaint.DrawStringDisabled() not
> Graphics.DrawString() twice.
> As for not being able to select Disabled Tabpages, that can be emulated,
> although I feel it is better to remove the TabPage than display it as
> Disabled.
>
> Code follows:
>
> \\\
> Private ValidPageIndex As Integer = 0
>
> Private Sub TabControl1_DrawItem(ByVal sender As Object, _
> ByVal e As System.Windows.Forms.DrawItemEventArgs) _
> Handles TabControl1.DrawItem
>
> Dim CurrentTabPage As TabPage = TabControl1.TabPages(e.Index)
> Dim r As RectangleF = RectangleF.op_Implicit(e.Bounds)
> Dim ItemBrush As New SolidBrush(TabControl1.BackColor)
> Dim TextBrush As New SolidBrush(TabControl1.ForeColor)
> Dim sf As New StringFormat
>
> sf.Alignment = StringAlignment.Center
> sf.LineAlignment = StringAlignment.Center
>
> e.Graphics.FillRectangle(ItemBrush, e.Bounds)
>
> If CurrentTabPage.Enabled = False Then
> ControlPaint.DrawStringDisabled(e.Graphics, _
> CurrentTabPage.Text, _
> e.Font, _
> ItemBrush.Color, _
> r, sf)
> Else
> e.Graphics.DrawString(CurrentTabPage.Text, _
> e.Font, _
> TextBrush, _
> r, sf)
> End If
>
> End Sub
>
> Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, _
> ByVal e As System.EventArgs) _
> Handles TabControl1.SelectedIndexChanged
>
> If TabControl1.SelectedTab.Enabled = False Then
> TabControl1.SelectedIndex = ValidPageIndex
> Else
> ValidPageIndex = TabControl1.SelectedIndex
> End If
> End Sub
>
> Private Sub Form1_Load(ByVal sender As System.Object, _
> ByVal e As System.EventArgs) _
> Handles MyBase.Load
> TabPage2.Enabled = False
> End Sub
> ///
>
> "SStory" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
> news:uZDMuIg2DHA.2180@TK2MSFTNGP12.phx.gbl...[color=green]
> > Mick,
> >
> > I told her the same thing, but how do you draw them with the normal 3d
> > enabled look?
> >
> > I tried drawstring using a layout rect and then offset(1,1) or[/color][/color]
offset(2,2)[color=blue][color=green]
> > on it and drew again using the same with a different color but it[/color][/color]
doesn't[color=blue][color=green]
> > work.
> >
> > Also,
> > disabled means you shouldn't even be able to select the tab in the first
> > place. How can this be accomplished?
> >
> > Thanks,
> >
> > Shane
> >[/color]
>
>[/color] | | | | re: Gray-out the text on the tab control display?
That or you could try to make your own control inheriting from the tab
control, "K's Tab Control"
Just add that functionality and display some interface for disabling
tabs....
You're right it's a pain and like most things I've found in .net, is a
standard expectation that should have been implemented in the original
control. (guess they want to make sure you go with 3rd part vendors and not
put them out of business or something.) Still there is lots of room for 3rd
party controls and I agree with you that things like this are just bare
minimum expected behaviors.
Removing the tab does seem to be a lot easier. I suggest that route unless
you want to make your own reusuable control--which shouldn't be too hard....
;) maybe.
Shane
"KMiller" <anonymous@discussions.microsoft.com> wrote in message
news:01cd01c3da09$9ca20310$a401280a@phx.gbl...[color=blue]
> Thanks for the responses to all..
>
> Seems like a lot of trouble to execute a very simple
> change. We purchases the Infragistics UltraDev suite a
> while back, which includes a tab control, but we had not
> been using it. I just checked it out and sure enough, it
> grays-out the text by simply disabling the tab. I may
> just swap out by MS tab for this one.
>
> K
>
>
>[color=green]
> >-----Original Message-----
> >Hi K,
> >
> >wow, I see your point.
> >
> >I thought I had it fixed in my app too but my titles[/color]
> aren't disabled either.[color=green]
> >
> >You can do ownerdrawn fixed and change the color of the[/color]
> font easy enough.[color=green]
> >
> >Private Sub TabControl1_DrawItem(ByVal sender As Object,[/color]
> ByVal e As[color=green]
> >System.Windows.Forms.DrawItemEventArgs) Handles[/color]
> TabControl1.DrawItem[color=green]
> > Dim tp As TabPage
> > Dim layoutrct As New RectangleF(e.Bounds.Left,[/color]
> e.Bounds.Top,[color=green]
> >e.Bounds.Width, e.Bounds.Height)
> > Dim sf As New StringFormat[/color]
> (StringFormatFlags.FitBlackBox)[color=green]
> > sf.Alignment = StringAlignment.Center
> > sf.LineAlignment = StringAlignment.Center
> >
> > tp = TabControl1.TabPages(e.Index)
> > If Not tp.Enabled Then
> > 'for some reason not printing the 3-d part--tried[/color]
> to print twice[color=green]
> >with offset but no luck
> > e.Graphics.DrawString(tp.Text, e.Font,[/color]
> SystemBrushes.ControlLight,[color=green]
> >layoutrct)
> > layoutrct.Offset(2, 2)
> > e.Graphics.DrawString(tp.Text, e.Font,[/color]
> SystemBrushes.ControlDark,[color=green]
> >layoutrct) 'SolidBrush(e.BackColor), layoutrct)
> > Else
> > e.Graphics.DrawString(tp.Text, e.Font,New[/color]
> SolidBrush(e.BackColor),[color=green]
> >layoutrct)
> > End If
> >End Sub
> >
> >This works if items are not enabled. But there must be[/color]
> an easier way--also[color=green]
> >they shouldn't even be able to click on the tab.
> >
> >I haven't found out how to avoid that.
> >
> >this is a really big pain for something simple--but it[/color]
> seems that most of[color=green]
> >the control included are lacking in very bacic features[/color]
> and require lots of[color=green]
> >extra coding to just do standard things.
> >
> >I hope you find an answer--I would also like to know.
> >
> >Shane
> >
> >
> >"KMiller" <anonymous@discussions.microsoft.com> wrote in[/color]
> message[color=green]
> >news:00c601c3d9f4$1ea7d8f0$a301280a@phx.gbl...[color=darkred]
> >> At the time the form is assembled, I DO NOT know.
> >> However, shortly thereafter (during the loading[/color][/color]
> process),[color=green][color=darkred]
> >> I DO know whether they have access or not to the
> >> particular tab. It's at this time when I'm attempting[/color][/color]
> to[color=green][color=darkred]
> >> disable (gray-out) the tab text, but nothing works.
> >>
> >> I've tried setting the enabled property to false for the
> >> tab, but doing that does nothing to the tab text[/color][/color]
> display,[color=green][color=darkred]
> >> and users have no way of knowing they DO NOT have access
> >> to the tab other then by clicking into it and finding[/color][/color]
> out[color=green][color=darkred]
> >> that nothing works because all the controls have been
> >> disabled. Leaving the functionality this way is
> >> inadequate and out of spec.
> >>
> >>
> >> >-----Original Message-----
> >> >I assume you don't know before loading the form which[/color][/color]
> to[color=green][color=darkred]
> >> enable/disable? If
> >> >so a contructor passed a tabindex would work fine.
> >> >
> >> >I also assume that you have tried setting the enabled
> >> property for the
> >> >particular tab page that you want disabled...
> >> >
> >> >Is this true?
> >> >
> >> >Shane
> >> >"KMiller" <anonymous@discussions.microsoft.com> wrote[/color][/color]
> in[color=green][color=darkred]
> >> message
> >> >news:05e801c3d94b$eed72e80$a101280a@phx.gbl...
> >> >> I would like to control entry into one or more of the
> >> tabs
> >> >> > I have set up on my Tab control based on set rules.
> >> Does
> >> >> > anyone know how to grey-out the text so that a user
> >> will
> >> >> > see that they do not have access to that particular
> >> tab?
> >> >> >
> >> >> > I tried setting the enabled = false for the given[/color][/color]
> tab,[color=green][color=darkred]
> >> >> but
> >> >> > it only seems to work in the form assembly section
> >> (that
> >> >> > is, if I do it after the form is loaded through a
> >> >> > function, it doesn't seem to work), and doing that
> >> >> > disables the controls on the tab, but does not grey
> >> out
> >> >> > the text of the tab display itself.
> >> >> >
> >> >> > Thanks
> >> >> >
> >> >> > K
> >> >>
> >> >
> >> >
> >> >.
> >> >[/color]
> >
> >
> >.
> >[/color][/color] | | | | re: Gray-out the text on the tab control display?
> Removing the tab does seem to be a lot easier. I suggest that route
unless[color=blue]
> you want to make your own reusuable control--which shouldn't be too[/color]
hard....[color=blue]
> ;) maybe.
>[/color]
Much harder than you'd think. I'm currently working on a new TabControl and
you wouldn't believe the amount of problems I'm coming up against, but it is
coming along. | | | | re: Gray-out the text on the tab control display?
A certain axiom comes to mind involving wheels and re-
invention ;}
[color=blue]
>-----Original Message-----[color=green]
>> Removing the tab does seem to be a lot easier. I[/color][/color]
suggest that route[color=blue]
>unless[color=green]
>> you want to make your own reusuable control--which[/color][/color]
shouldn't be too[color=blue]
>hard....[color=green]
>> ;) maybe.
>>[/color]
>Much harder than you'd think. I'm currently working on a[/color]
new TabControl and[color=blue]
>you wouldn't believe the amount of problems I'm coming up[/color]
against, but it is[color=blue]
>coming along.
>
>
>.
>[/color] | | | | re: Gray-out the text on the tab control display?
Not re-inventing - but remodelling.
"KMiller" <anonymous@discussions.microsoft.com> wrote in message
news:0b2f01c3da20$fbe1be30$a001280a@phx.gbl...[color=blue]
> A certain axiom comes to mind involving wheels and re-
> invention ;}
>
>[color=green]
> >-----Original Message-----[color=darkred]
> >> Removing the tab does seem to be a lot easier. I[/color][/color]
> suggest that route[color=green]
> >unless[color=darkred]
> >> you want to make your own reusuable control--which[/color][/color]
> shouldn't be too[color=green]
> >hard....[color=darkred]
> >> ;) maybe.
> >>[/color]
> >Much harder than you'd think. I'm currently working on a[/color]
> new TabControl and[color=green]
> >you wouldn't believe the amount of problems I'm coming up[/color]
> against, but it is[color=green]
> >coming along.
> >
> >
> >.
> >[/color][/color] | | | | re: Gray-out the text on the tab control display?
Wow!
I guess the point is that we shouldn't have to do it in the first place.
That should have been included in any standard tab control I would think.
"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:OFiqQ7i2DHA.4060@TK2MSFTNGP11.phx.gbl...[color=blue]
> Not re-inventing - but remodelling.
>
> "KMiller" <anonymous@discussions.microsoft.com> wrote in message
> news:0b2f01c3da20$fbe1be30$a001280a@phx.gbl...[color=green]
> > A certain axiom comes to mind involving wheels and re-
> > invention ;}
> >
> >[color=darkred]
> > >-----Original Message-----
> > >> Removing the tab does seem to be a lot easier. I[/color]
> > suggest that route[color=darkred]
> > >unless
> > >> you want to make your own reusuable control--which[/color]
> > shouldn't be too[color=darkred]
> > >hard....
> > >> ;) maybe.
> > >>
> > >Much harder than you'd think. I'm currently working on a[/color]
> > new TabControl and[color=darkred]
> > >you wouldn't believe the amount of problems I'm coming up[/color]
> > against, but it is[color=darkred]
> > >coming along.
> > >
> > >
> > >.
> > >[/color][/color]
>
>[/color] |  | Similar Visual Basic .NET bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|