473,394 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

XP Themed controls on a Tab Control?

I decided to use a tab control for my latest project. On Windows XP, the
tab control itself is themed (tabs are themed), but the tab pages and
any controls I put on them are not themed (except for textboxes).

Done a bit of googling on this subject and I found a lot of people with
the same problem, but no real solution.

Has anyone come up with a good way to get controls to appear themed on a
tab page?

*** Sent via Developersdex http://www.developersdex.com ***
Dec 15 '05 #1
6 1517
If you mean many of the contained controls appear as black on some systems,
then I have come across this problem. I have not found an answer.

Best wishes

Paul Bromley
"Terry Olsen" <to******@hotmail.com> wrote in message
news:uS*************@TK2MSFTNGP12.phx.gbl...
I decided to use a tab control for my latest project. On Windows XP, the
tab control itself is themed (tabs are themed), but the tab pages and
any controls I put on them are not themed (except for textboxes).

Done a bit of googling on this subject and I found a lot of people with
the same problem, but no real solution.

Has anyone come up with a good way to get controls to appear themed on a
tab page?

*** Sent via Developersdex http://www.developersdex.com ***

Dec 15 '05 #2
They don't appear black. The command buttons and radio buttons I put on
the tab page are displayed as they appear in Windows 2000 and below. I
have the FlatStyle set to System but that doesn't help. The wierd thing
is that the textboxes that I put on the tab page DO appear as XP themed
controls.

*** Sent via Developersdex http://www.developersdex.com ***
Dec 15 '05 #3

"Terry Olsen" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
They don't appear black. The command buttons and radio buttons I put on
the tab page are displayed as they appear in Windows 2000 and below. I
have the FlatStyle set to System but that doesn't help. The wierd thing
is that the textboxes that I put on the tab page DO appear as XP themed
controls.


Terry, I was going to post and say that this sort of stuff is fixed in VS
2005 (I know they did a lot of work with themes in .NET 2.0). But I just
threw together a 2003 project to see the issue and everything on my tab page
is XP themed...? Although I've read, using themes in 1.1 can lead to a
world of hurt. :)

I changed Button1 and Radiobutton1's FlatStyle to System and launched the
form from a Sub Main after enabling visual styles.

Can you duplicate with my posted code?

Greg
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.TabControl1 = New System.Windows.Forms.TabControl
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.Button1 = New System.Windows.Forms.Button
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.Button2 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TabControl1.SuspendLayout()
Me.TabPage1.SuspendLayout()
Me.SuspendLayout()
'
'TabControl1
'
Me.TabControl1.Controls.Add(Me.TabPage1)
Me.TabControl1.Location = New System.Drawing.Point(40, 32)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(456, 352)
Me.TabControl1.TabIndex = 0
'
'TabPage1
'
Me.TabPage1.Controls.Add(Me.TextBox1)
Me.TabPage1.Controls.Add(Me.Button1)
Me.TabPage1.Controls.Add(Me.RadioButton1)
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(448, 326)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "TabPage1"
'
'Button1
'
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.Button1.Location = New System.Drawing.Point(24, 72)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'RadioButton1
'
Me.RadioButton1.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.RadioButton1.Location = New System.Drawing.Point(24, 32)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.TabIndex = 0
Me.RadioButton1.Text = "RadioButton1"
'
'Button2
'
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.Button2.Location = New System.Drawing.Point(296, 416)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 1
Me.Button2.Text = "Button2"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(24, 112)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.TabIndex = 2
Me.TextBox1.Text = "TextBox1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(656, 478)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TabControl1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.TabControl1.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Public Shared Sub Main()

System.Windows.Forms.Application.EnableVisualStyle s()
System.Windows.Forms.Application.Run(New Form1)

End Sub 'Main

End Class
Dec 15 '05 #4
I got this one figured out, though I don't know why this works. Here's
the code I was using to enable visual styles:

<System.STAThread()> _
Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then _
System.Windows.Forms.Application.EnableVisualStyle s()
End If
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

This worked for everything I've written up until now, when I used the
Tab Control. Seems in order to get the controls to be themed when on
the tab control, you must put an Application.DoEvents just before the
Run(New Form1) line and behold, all controls are now themed.

So the new code looks like this:

<System.STAThread()> _
Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then _
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

If someone knows WHY this works, clue me in, will ya?

Thanks!
*** Sent via Developersdex http://www.developersdex.com ***
Dec 16 '05 #5
I had read of adding the DoEvents line, and almost included it. But my
example seemed to work without, so I didn't.

I seriously would consider upgrading to 2005 (if it is an option) before
investing too much effort with XP Themes. I've read that people have had
some weird, hard to troubleshoot problems due soley to using themes and .NET
1.x. YMMV

Greg
"Terry Olsen" <to******@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...
I got this one figured out, though I don't know why this works. Here's
the code I was using to enable visual styles:

<System.STAThread()> _
Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then _
System.Windows.Forms.Application.EnableVisualStyle s()
End If
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

This worked for everything I've written up until now, when I used the
Tab Control. Seems in order to get the controls to be themed when on
the tab control, you must put an Application.DoEvents just before the
Run(New Form1) line and behold, all controls are now themed.

So the new code looks like this:

<System.STAThread()> _
Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then _
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

If someone knows WHY this works, clue me in, will ya?

Thanks!
*** Sent via Developersdex http://www.developersdex.com ***

Dec 16 '05 #6
I use 2005 for personal projects at home. However, I must use 2003 at work
because they have not yet certified Framework 2.0. Until they clear it for
use on company hardware, I'm stuck with 2003. The XP Theme is not required,
but some of the workstations have been upgraded to XP from 2K and a change
of scenery is nice...

"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:uo**************@TK2MSFTNGP09.phx.gbl...
I had read of adding the DoEvents line, and almost included it. But my
example seemed to work without, so I didn't.

I seriously would consider upgrading to 2005 (if it is an option) before
investing too much effort with XP Themes. I've read that people have had
some weird, hard to troubleshoot problems due soley to using themes and
.NET 1.x. YMMV

Greg
"Terry Olsen" <to******@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...
I got this one figured out, though I don't know why this works. Here's
the code I was using to enable visual styles:

<System.STAThread()> _
Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then _
System.Windows.Forms.Application.EnableVisualStyle s()
End If
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

This worked for everything I've written up until now, when I used the
Tab Control. Seems in order to get the controls to be themed when on
the tab control, you must put an Application.DoEvents just before the
Run(New Form1) line and behold, all controls are now themed.

So the new code looks like this:

<System.STAThread()> _
Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then _
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

If someone knows WHY this works, clue me in, will ya?

Thanks!
*** Sent via Developersdex http://www.developersdex.com ***


Dec 16 '05 #7

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

Similar topics

1
by: Tom | last post by:
Hi friends my question is is it possible to export the xp theme so that even when app is eventually deployed on win98 or 2000 the UI will be consistent to that of XP ? Thanks Tom
3
by: Tim Marshall | last post by:
I would swear that when I developed in A97, I could change the back colour of a form. However, in Windows XP, on both A97 and A2003, there no longer is a property showing in the format tab for...
0
by: Wayne | last post by:
I've been to the MS website but can't find a resolution to either of the following. When using themed controls, command buttons have a one pixel light colored dot just outside each corner. It is...
2
by: Darryl Kerkeslager | last post by:
It seems that the only way to make themed AND classic Windows GUIs look okay with tab controls and subforms, due to the color issue, is to place a one page-no button tab control on each subform...
1
by: Wayne | last post by:
Not sure if anyone else has noticed this, but it gets around one of the more annoying limitations of using themed controls. Normally when using themed controls a triple state check box looks the...
5
by: samuelberthelot | last post by:
Hi, I get this exception when I use a themed css file. In my web.config file I have: <pages theme="dRise"> and the trouble page is a master page : <% Response.Write(Header)%> <form...
1
by: Trapulo | last post by:
Hello, I've this problem. I need to create a web app, where some text are localized in many languages. That's ok: I can use "App_Localresources" and related features, and all works. Now, I need...
0
by: Tim Marshall | last post by:
A2003. I rather like the appearance I get with windows themed controls turned on, but I'm running into an odd problem with tab controls. When I set the back style to transparent, it really isn't...
0
by: Wayne | last post by:
This is probably trivial, but annoying just the same. Has anyone noticed in Access 2003 when using themed controls that the mouseover color fringing does not seem to work properly on command...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.