473,387 Members | 1,791 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,387 software developers and data experts.

xp styles and control forecolor problems

When you use xp styles

Application.EnableVisualStyles()

Application.DoEvents()

and you change a control's flat style to 'system', you then are not able to
set the control's forecolor, or if you did set it, it reverts to the default
forecolor. Any way to change the forecolor even if xp styles are on and the
flat style is system?

Thanks for any help.

Bernie Yaeger


Nov 20 '05 #1
5 1267
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
When you use xp styles

Application.EnableVisualStyles()

Application.DoEvents()

and you change a control's flat style to 'system', you then are not able to
set the control's forecolor, or if you did set it, it reverts to the default
forecolor. Any way to change the forecolor even if xp styles are on and the
flat style is system?


No. You cannot change the color of themed controls.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hi Herfried,

Tx for the answer; too bad. Maybe in the next release of the framework.

Bernie

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:Om**************@TK2MSFTNGP10.phx.gbl...
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
When you use xp styles

Application.EnableVisualStyles()

Application.DoEvents()

and you change a control's flat style to 'system', you then are not able to set the control's forecolor, or if you did set it, it reverts to the default forecolor. Any way to change the forecolor even if xp styles are on and the flat style is system?


No. You cannot change the color of themed controls.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
Tx for the answer; too bad. Maybe in the next release of the framework.


I don't think so.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Setting FlatStyle to System causes the control to use the current
System.Colors. In order to use your own colors and apply Visual Styles you
must OwnerDraw the control. I have written a Button control which Inherits
from button and allows you to Apply Visual Styles with the FlatStyle set to
Standard. As well as still using your choice of ForeColor, it allows you to
use the Image. You can find this controls SourceCode at:

<www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=1900&lngWId=10>

I used a complicated method to draw the background and have since discovered
the DrawThemeParentBackground API call which does that for you, but I will
not be updating the source as the method I used shows how to test for a
property in another control and that could be beneficial.

You can use this example as a guide to create other controls which behave
similarly.

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
When you use xp styles

Application.EnableVisualStyles()

Application.DoEvents()

and you change a control's flat style to 'system', you then are not able to set the control's forecolor, or if you did set it, it reverts to the default forecolor. Any way to change the forecolor even if xp styles are on and the flat style is system?

Thanks for any help.

Bernie Yaeger


Nov 20 '05 #5
Tx Mick - I'll give it a try.

Bernie

"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:Oy**************@tk2msftngp13.phx.gbl...
Setting FlatStyle to System causes the control to use the current
System.Colors. In order to use your own colors and apply Visual Styles you
must OwnerDraw the control. I have written a Button control which Inherits
from button and allows you to Apply Visual Styles with the FlatStyle set to Standard. As well as still using your choice of ForeColor, it allows you to use the Image. You can find this controls SourceCode at:

<www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=1900&lngWId=10>
I used a complicated method to draw the background and have since discovered the DrawThemeParentBackground API call which does that for you, but I will
not be updating the source as the method I used shows how to test for a
property in another control and that could be beneficial.

You can use this example as a guide to create other controls which behave
similarly.

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
When you use xp styles

Application.EnableVisualStyles()

Application.DoEvents()

and you change a control's flat style to 'system', you then are not able

to
set the control's forecolor, or if you did set it, it reverts to the

default
forecolor. Any way to change the forecolor even if xp styles are on and

the
flat style is system?

Thanks for any help.

Bernie Yaeger



Nov 20 '05 #6

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

Similar topics

6
by: Christopher Young | last post by:
I have several user controls on a page and I am trying to get information out of them. The postback is being caused on the aspx page and not in the user control. I have tried using a property but...
2
by: JezB | last post by:
A web control can have a ForeColor property, a Style collection which can define a "color" property, and a CssClass property which also defines a "color" property. Which takes precedence? Is...
2
by: Sky Sigal | last post by:
Hello: I'm currently messing around, and need as much feedback/help as I can get, trying to find the most economical/graceful way to build usercontrols that rely on styling to look any good... ...
11
by: PAul Maskens | last post by:
The form designer adds unnecessary code to the section when using a subclassed control. I've reproduced this in VS.NET 2002 and VS.NET 2003 so it's pretty fundamental. Outline steps: Create a...
1
by: bors | last post by:
Hi everybody! I have TreeView and I want to mark parent node where his child is beeing selected. Other words - I'm klicking on some child node and I want to show that this node AND his parent ist...
2
by: tacmec | last post by:
ASP.NET 2.0 (C#) application. I have a web form with a GridView, which is populated dynamically. See the code below. First time to the page, IsPostBack is false. Therefore, DisplayItems() is...
3
by: Bob | last post by:
Hi, i'm testing the order of application when it comes to styling with skin and CSS files and i come to contradiction between what i get and what i read about theme and CSS. I wrote that...
0
by: jaredciagar | last post by:
Hi Guys, Can You Help Me PLease, I'm Currently facing Problems in my system... I need some help... I'm using VB script,ASP.net,MS SQL Server2005 I want to select a specific data in...
2
by: Josh Valino | last post by:
Hi, I'd like to take the style properties from one control and apply them all to the properties of another control, where they relate. The situation is this: I have a TreeView control, and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.