473,701 Members | 2,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1541
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******@hotma il.com> wrote in message
news:uS******** *****@TK2MSFTNG P12.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******@hotma il.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.
InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() 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.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er

'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.TabContro l
Friend WithEvents TabPage1 As System.Windows. Forms.TabPage
Friend WithEvents RadioButton1 As System.Windows. Forms.RadioButt on
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.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.TabControl1 = New System.Windows. Forms.TabContro l
Me.TabPage1 = New System.Windows. Forms.TabPage
Me.Button1 = New System.Windows. Forms.Button
Me.RadioButton1 = New System.Windows. Forms.RadioButt on
Me.Button2 = New System.Windows. Forms.Button
Me.TextBox1 = New System.Windows. Forms.TextBox
Me.TabControl1. SuspendLayout()
Me.TabPage1.Sus pendLayout()
Me.SuspendLayou t()
'
'TabControl1
'
Me.TabControl1. Controls.Add(Me .TabPage1)
Me.TabControl1. Location = New System.Drawing. Point(40, 32)
Me.TabControl1. Name = "TabControl 1"
Me.TabControl1. SelectedIndex = 0
Me.TabControl1. Size = New System.Drawing. Size(456, 352)
Me.TabControl1. TabIndex = 0
'
'TabPage1
'
Me.TabPage1.Con trols.Add(Me.Te xtBox1)
Me.TabPage1.Con trols.Add(Me.Bu tton1)
Me.TabPage1.Con trols.Add(Me.Ra dioButton1)
Me.TabPage1.Loc ation = New System.Drawing. Point(4, 22)
Me.TabPage1.Nam e = "TabPage1"
Me.TabPage1.Siz e = New System.Drawing. Size(448, 326)
Me.TabPage1.Tab Index = 0
Me.TabPage1.Tex t = "TabPage1"
'
'Button1
'
Me.Button1.Flat Style = System.Windows. Forms.FlatStyle .System
Me.Button1.Loca tion = New System.Drawing. Point(24, 72)
Me.Button1.Name = "Button1"
Me.Button1.TabI ndex = 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 = "RadioButto n1"
Me.RadioButton1 .TabIndex = 0
Me.RadioButton1 .Text = "RadioButto n1"
'
'Button2
'
Me.Button2.Flat Style = System.Windows. Forms.FlatStyle .System
Me.Button2.Loca tion = New System.Drawing. Point(296, 416)
Me.Button2.Name = "Button2"
Me.Button2.TabI ndex = 1
Me.Button2.Text = "Button2"
'
'TextBox1
'
Me.TextBox1.Loc ation = New System.Drawing. Point(24, 112)
Me.TextBox1.Nam e = "TextBox1"
Me.TextBox1.Tab Index = 2
Me.TextBox1.Tex t = "TextBox1"
'
'Form1
'
Me.AutoScaleBas eSize = 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(Fa lse)
Me.TabPage1.Res umeLayout(False )
Me.ResumeLayout (False)

End Sub

#End Region

Public Shared Sub Main()

System.Windows. Forms.Applicati on.EnableVisual Styles()
System.Windows. Forms.Applicati on.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.STAThre ad()> _
Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then _
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
System.Windows. Forms.Applicati on.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.DoE vents just before the
Run(New Form1) line and behold, all controls are now themed.

So the new code looks like this:

<System.STAThre ad()> _
Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then _
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents
System.Windows. Forms.Applicati on.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******@hotma il.com> wrote in message
news:eN******** ******@TK2MSFTN GP11.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.STAThre ad()> _
Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then _
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
System.Windows. Forms.Applicati on.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.DoE vents just before the
Run(New Form1) line and behold, all controls are now themed.

So the new code looks like this:

<System.STAThre ad()> _
Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then _
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents
System.Windows. Forms.Applicati on.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*******@news groups.nospam> wrote in message
news:uo******** ******@TK2MSFTN GP09.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******@hotma il.com> wrote in message
news:eN******** ******@TK2MSFTN GP11.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.STAThre ad()> _
Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then _
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
System.Windows. Forms.Applicati on.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.DoE vents just before the
Run(New Form1) line and behold, all controls are now themed.

So the new code looks like this:

<System.STAThre ad()> _
Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then _
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents
System.Windows. Forms.Applicati on.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
1171
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
2600
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 form properties for a back colour. I think the themed control idea is pretty good in that a developer can really go out on a limb if s/he chooses all kinds of fancy background colours for his/her app since colours selection is a very subjective...
0
1147
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 most noticable if the form has a dark colored background. Has anyone else noticed this? The other problem which I've seen mentioned on this group before is the fact that triple state check boxes don't show the Null state when themed controls...
2
2087
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 that will be displayed as part of a main form's tab control, completely covering the subform's detail, and then pasting all the controls onto it. However, this is major cosmetic surgery. 1. Is there some secret way to re-attach event procedures...
1
4120
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 same in the unchecked and null states - very annoying and not all that useful. Today I found by accident that if the border style of the checkbox is set to anything other than "solid", the check box takes on the appearance of a non-themed...
5
15024
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 id="form1" runat="server"> <div class="FormContent">
1
1316
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 also to create different "skins" of this application. This is also ok: I can use themes and all works, so I have logos, etc. that change based on active skin. The problem is that now I need to create personal messages for each skin, in each...
0
1765
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 transparent. I'm finding instead of one text box or a button that I'd like to have on the form "shining through" and displaying with all pages, it's as if the tab control keeps the odd colour background it generates. I originally developed the...
0
1093
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 buttons that have an image displayed instead of text? Or is this just happening on my machine?
0
8737
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8649
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9084
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
8978
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
7827
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...
0
4411
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4665
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
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.