-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: Vipul
Message 14 in Discussion
New Message on MumbaiUserGroup
How to Disable a Tab on System.Windows.Forms.TabControl?
Reply
Reply to Sender
Recommend
Message 11 in Discussion
From:
Vipul
New Message on MumbaiUserGroup
How to Disable a Tab on System.Windows.Forms.TabControl?
Reply
Reply to Sender
Recommend
Message 4 in Discussion
From:
Vipul
I am sorry to say that your approach simply of
my.Forms.Form1.TabControl1.TabPages[1].Enabled
will not work.
Tab controls are not designed to act in that manner..
A detailed explanation is available at
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=172581&SiteID=1 Set
DrawMode to OwnerDrawFixed Attach the TabControl.Selecting event to
tabControl1_Selecting Attach the TabControl.DrawItem event to
tabControl1_DrawItem In your constructor, disable the tabpage (# 2)
Add this code in your form
Private Sub TabControl1_Selecting(ByVal sender As Object, ByVal e As
System.Windows.Forms.TabControlCancelEventArgs) Handles TabControl1.Selecting
If (Not e.TabPage.Enabled) Then
e.Cancel = True
End If
End Sub
Convert the following code to VB equivalent before using it
private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
TabPage page = tabControl1.TabPages[e.Index];
if (!page.Enabled)
{
using (SolidBrush brush = new SolidBrush(SystemColors.GrayText))
{
e.Graphics.DrawString(page.Text, page.Font, brush, e.Bounds);
}
}
else
{
using (SolidBrush brush = new SolidBrush(page.ForeColor))
{
e.Graphics.DrawString(page.Text, page.Font, brush, e.Bounds);
}
}
}
Hope this helps.
View other groups in this category.
View other groups in this category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]