Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing DefaultBackColor Property

Status
Not open for further replies.

atruhoo

Programmer
Jan 8, 2003
131
US
Trying to change the DefaultBackColor Property in a tabcontrol so that it matches the color of the form my users selected. Know I can change the backcolor of the tabpage but stumped so far with this and since I have been finding limited information on this I hoped some of the experts here could help. Here is what I have so far.

Public Class Custom_TabControl
Inherits System.Windows.Forms.TabControl
Private Shared test As Color = Color.Gainsboro

Private Shared Shadows ReadOnly Property DefaultBackColor() As Color
Get
Return test.Gainsboro
End Get
End Property


End Class
 
I am unsure of what exactly you requirement is but the following code makes the color of tabpage same as your form

TabControl1.TabPages(0).BackColor = System.Drawing.SystemColors.Control
TabControl1.TabPages(1).BackColor = System.Drawing.SystemColors.Control

hope this helps!!!

 
Was/am trying to change the DefaultBackColor property of the tabcontrol as it is set to systemcolors.control by default. Users had selected Gainsboro Gray as the color for the application. Code you gave above sets the color of the tabpages the same as the default color for the tabpages.

The code found on the link in my previous post appears to meet my requirements but for now I am using the control on his page which does what I need. Appreciate you taking a shot though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top