473,657 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

challenge?

this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at night, only
dark cyan (or similar) color must be used on display (much like the radar
display) otherwise the captain will be blinded by the bright colors.

When at night, the user clicks on a button to turn the application into
night mode. I do not want to go through all the objects (over 1000) to
change each color, I am thinking that maybe I can change the palette of
Windows or VB, the computer they are using is designated to run my
application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at night mode
and return to normal on day mode?
Thanks in advance.
Nov 21 '05 #1
11 1363

anthony wrote:
this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at night, only dark cyan (or similar) color must be used on display (much like the radar display) otherwise the captain will be blinded by the bright colors.

When at night, the user clicks on a button to turn the application into night mode. I do not want to go through all the objects (over 1000) to change each color, I am thinking that maybe I can change the palette of Windows or VB, the computer they are using is designated to run my
application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at night mode and return to normal on day mode?


Given that your app has sole use of the PC, sounds like the easiest way
would be to make sure all your controls use SystemColors, then change
the *global* Windows colour scheme (you know, where you set what colour
title bars and stuff are). I just did a quick test and a VB.NET 2002
app running on Win2k changes colours *automatically* when the Windows
colour scheme changes, so you should be alright.

Now the question becomes how to change that Windows setting? I suspect
it will involve P/Invoke'ing the API, but I don't expect it to be
particularly difficult. You can find this yourself, or you want more?

--
Larry Lard
Replies to group please

Nov 21 '05 #2

Larry Lard wrote:
anthony wrote:
this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at night, only
dark cyan (or similar) color must be used on display (much like the

radar
display) otherwise the captain will be blinded by the bright colors.
When at night, the user clicks on a button to turn the application

into
night mode. I do not want to go through all the objects (over

1000) to
change each color, I am thinking that maybe I can change the
palette of
Windows or VB, the computer they are using is designated to run my
application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at
night mode
and return to normal on day mode?
Given that your app has sole use of the PC, sounds like the easiest

way would be to make sure all your controls use SystemColors, then change
the *global* Windows colour scheme (you know, where you set what colour title bars and stuff are). I just did a quick test and a VB.NET 2002
app running on Win2k changes colours *automatically* when the Windows
colour scheme changes, so you should be alright.

Now the question becomes how to change that Windows setting? I suspect it will involve P/Invoke'ing the API, but I don't expect it to be
particularly difficult. You can find this yourself, or you want more?


[replying to self]
(it's SetSysColor but...)
Actually, why re-invent the wheel? Just make sure your app uses only
SystemColor's for its colours, then the user can just use Control Panel
| Display to switch to a night-time scheme at night, and (as I have
established) your app will switch automatically.

--
Larry Lard
Replies to group please

Nov 21 '05 #3
"anthony" <an*******@cont rolengineer.com > wrote in
news:u$******** *****@TK2MSFTNG P15.phx.gbl:
this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at night,
only dark cyan (or similar) color must be used on display (much like
the radar display) otherwise the captain will be blinded by the bright
colors.

When at night, the user clicks on a button to turn the application
into night mode. I do not want to go through all the objects (over
1000) to change each color, I am thinking that maybe I can change the
palette of Windows or VB, the computer they are using is designated to
run my application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at night
mode and return to normal on day mode?
Thanks in advance.


See getsyscolors and setsyscolors in the library (Platform SDK), not sure
how to use it. I'll have a go...
Nov 21 '05 #4
Thanks Larry,

Do you know which API to invoke? GDI+ or DirectX API or sth else...?
"Larry Lard" <la*******@hotm ail.com> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...

anthony wrote:
this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at

night, only
dark cyan (or similar) color must be used on display (much like the

radar
display) otherwise the captain will be blinded by the bright colors.

When at night, the user clicks on a button to turn the application

into
night mode. I do not want to go through all the objects (over 1000)

to
change each color, I am thinking that maybe I can change the palette

of
Windows or VB, the computer they are using is designated to run my
application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at night

mode
and return to normal on day mode?


Given that your app has sole use of the PC, sounds like the easiest way
would be to make sure all your controls use SystemColors, then change
the *global* Windows colour scheme (you know, where you set what colour
title bars and stuff are). I just did a quick test and a VB.NET 2002
app running on Win2k changes colours *automatically* when the Windows
colour scheme changes, so you should be alright.

Now the question becomes how to change that Windows setting? I suspect
it will involve P/Invoke'ing the API, but I don't expect it to be
particularly difficult. You can find this yourself, or you want more?

--
Larry Lard
Replies to group please

Nov 21 '05 #5
I actually have to place a button or menu item on my application to do so, I
would have a hard time to explain what a Windows Control Panel to the boat
user/captain, so a one-click way is essental, I will look at the SetSysColor
you suggest.

Thanks!

"Larry Lard" <la*******@hotm ail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...

Larry Lard wrote:
anthony wrote:
this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at

night, only
dark cyan (or similar) color must be used on display (much like the

radar
display) otherwise the captain will be blinded by the bright colors.
When at night, the user clicks on a button to turn the application

into
night mode. I do not want to go through all the objects (over

1000)
to
change each color, I am thinking that maybe I can change the

palette
of
Windows or VB, the computer they are using is designated to run my
application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at

night
mode
and return to normal on day mode?


Given that your app has sole use of the PC, sounds like the easiest

way
would be to make sure all your controls use SystemColors, then change
the *global* Windows colour scheme (you know, where you set what

colour
title bars and stuff are). I just did a quick test and a VB.NET 2002
app running on Win2k changes colours *automatically* when the Windows
colour scheme changes, so you should be alright.

Now the question becomes how to change that Windows setting? I

suspect
it will involve P/Invoke'ing the API, but I don't expect it to be
particularly difficult. You can find this yourself, or you want more?


[replying to self]
(it's SetSysColor but...)
Actually, why re-invent the wheel? Just make sure your app uses only
SystemColor's for its colours, then the user can just use Control Panel
| Display to switch to a night-time scheme at night, and (as I have
established) your app will switch automatically.

--
Larry Lard
Replies to group please

Nov 21 '05 #6
Bob
Just an idea, why not cut the wire to the monitor and install a switch that cuts or attenuates the
blue and green pins' signals? I'm not familiar with marine standards, but I know that red is a good
color for not affecting night vision. Not exactly a software solution, but it's also the simplest
and most general... I also happen to know it works from when I had to use a monitor with a bad blue
pin. The captain may also appreciate a nice beefy physical switch instead of having to shade the
monitor in full sunlight to be able to see it well enough to get it out of night mode.

Robert

"anthony" <an*******@cont rolengineer.com > wrote in message
news:u$******** *****@TK2MSFTNG P15.phx.gbl...
this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at night, only
dark cyan (or similar) color must be used on display (much like the radar
display) otherwise the captain will be blinded by the bright colors.

When at night, the user clicks on a button to turn the application into
night mode. I do not want to go through all the objects (over 1000) to
change each color, I am thinking that maybe I can change the palette of
Windows or VB, the computer they are using is designated to run my
application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at night mode
and return to normal on day mode?
Thanks in advance.

Nov 21 '05 #7
You could cycle through the controls collection of the form and modify all
the controls that way. If you do it static this way you only have to check
if the control is a type you want to change. Have every form pass in it's
controls and you have it solved with only writing one function.

Public Class ColorChange
Pulblic Static Sub NightMode(byref Ctrs as Collection)
dim Ctr as Control
For each ctr in ctrs
if ctr typeof ...... then 'forget the code to check if the type
is the same

end if
next
End Sub
End Class

Hope it helps some..
Chris
"anthony" <an*******@cont rolengineer.com > wrote in message
news:u$******** *****@TK2MSFTNG P15.phx.gbl...
this one is really a challenge to me.

the application i developed in VB.NET 2003 runs on marine boat, the
application has many screens and controls. On a marine boat at night,
only
dark cyan (or similar) color must be used on display (much like the radar
display) otherwise the captain will be blinded by the bright colors.

When at night, the user clicks on a button to turn the application into
night mode. I do not want to go through all the objects (over 1000) to
change each color, I am thinking that maybe I can change the palette of
Windows or VB, the computer they are using is designated to run my
application only, so it will not affect other application.

Is there a way i can change for example the definition of
SystemColors.Co ntrol.Yellow to SystemColors.Co ntrol.DarkCyan at night mode
and return to normal on day mode?
Thanks in advance.

Nov 21 '05 #8
Thanks for all your suggestions, I am trying each one right now, I found the
API working like this:

Private Declare Function SetSysColors Lib "user32" _

(ByVal nChanges As Integer, ByRef lpSysColor As Integer, ByRef lpColorValues
As Integer) As Integer

Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As
Long

Const COLOR_SCROLLBAR = 0 'The Scrollbar colour

Const COLOR_BACKGROUN D = 1 'Colour of the background with no wallpaper

Const COLOR_ACTIVECAP TION = 2 'Caption of Active Window

Const COLOR_INACTIVEC APTION = 3 'Caption of Inactive window

Const COLOR_MENU = 4 'Menu

Const COLOR_WINDOW = 5 'Windows background

Const COLOR_WINDOWFRA ME = 6 'Window frame

Const COLOR_MENUTEXT = 7 'Window Text

Const COLOR_WINDOWTEX T = 8 '3D dark shadow (Win95)

Const COLOR_CAPTIONTE XT = 9 'Text in window caption

Const COLOR_ACTIVEBOR DER = 10 'Border of active window

Const COLOR_INACTIVEB ORDER = 11 'Border of inactive window

Const COLOR_APPWORKSP ACE = 12 'Background of MDI desktop

Const COLOR_HIGHLIGHT = 13 'Selected item background

Const COLOR_HIGHLIGHT TEXT = 14 'Selected menu item

Const COLOR_BTNFACE = 15 'Button

Const COLOR_BTNSHADOW = 16 '3D shading of button

Const COLOR_GRAYTEXT = 17 'Grey text, of zero if dithering is used.

Const COLOR_BTNTEXT = 18 'Button text

Const COLOR_INACTIVEC APTIONTEXT = 19 'Text of inactive window

Const COLOR_BTNHIGHLI GHT = 20 '3D highlight of button

Const COLOR_2NDACTIVE CAPTION = 27 'Win98 only: 2nd active window color

Const COLOR_2NDINACTI VECAPTION = 28 'Win98 only: 2nd inactive window color

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click

Dim col As Long, t As Long

'Get the caption's active color

col = GetSysColor(COL OR_BACKGROUND)

'Change the active caption's color to red

t = SetSysColors(1, COLOR_BACKGROUN D, RGB(255, 0, 0))

MsgBox("The old title bar color was" + Str$(col) + " and is now" +
Str$(GetSysColo r(COLOR_ACTIVEC APTION)))

End Sub


Nov 21 '05 #9
Anthony,
The definitions should be:

Private Declare Function SetSysColors Lib "user32" _
(ByVal nChanges As Integer, ByVal lpSysColor() As Integer, _
ByVal lpColorValues() As Integer) As Boolean

Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As
Integer) _
As Integer

Rather then use a list of disparate constants for an API, I normally create
an Enum, something like:

Public Enum SystemColor As Integer
ScrollBar = 0 'The Scrollbar colour
BackGround = 1 'Colour of the background with no wallpaper
ActiveCaption = 2 'Caption of Active Window
InactiveCaption = 3 'Caption of Inactive window
Menu = 4 'Menu
Window = 5 'Windows background
WindowFrame = 6 'Window frame
MenuText = 7 'Window Text
WindowText = 8 '3D dark shadow (Win95)
CaptionText = 9 'Text in window caption
ActiveBorder = 10 'Border of active window
InactiveBorder = 11 'Border of inactive window
AppWorkspace = 12 'Background of MDI desktop
Highlight = 13 'Selected item background
HighlightText = 14 'Selected menu item
BtnFace = 15 'Button
BtnShadow = 16 '3D shading of button
GrayText = 17 'Grey text, of zero if dithering is used.
BtnText = 18 'Button text
InactiveCaption Text = 19 'Text of inactive window
BtnHightList = 20 '3D highlight of button
SecondActiveCat pion = 27 'Win98 only: 2nd active window color
SecondInactiveC aption = 28 'Win98 only: 2nd inactive window color
End Enum

Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As
Integer, ByVal lpSysColor() As SystemColor, ByVal lpColorValues() As
Integer) As Integer

Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As
SystemColor) As Integer

As this gives intellisense on the API call itself, and neatly encapsulates
the constants in a single type...

Hope this helps
Jay
"anthony" <an*******@cont rolengineer.com > wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Thanks for all your suggestions, I am trying each one right now, I found
the
API working like this:

Private Declare Function SetSysColors Lib "user32" _

(ByVal nChanges As Integer, ByRef lpSysColor As Integer, ByRef
lpColorValues
As Integer) As Integer

Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long)
As
Long

Const COLOR_SCROLLBAR = 0 'The Scrollbar colour

Const COLOR_BACKGROUN D = 1 'Colour of the background with no wallpaper

Const COLOR_ACTIVECAP TION = 2 'Caption of Active Window

Const COLOR_INACTIVEC APTION = 3 'Caption of Inactive window

Const COLOR_MENU = 4 'Menu

Const COLOR_WINDOW = 5 'Windows background

Const COLOR_WINDOWFRA ME = 6 'Window frame

Const COLOR_MENUTEXT = 7 'Window Text

Const COLOR_WINDOWTEX T = 8 '3D dark shadow (Win95)

Const COLOR_CAPTIONTE XT = 9 'Text in window caption

Const COLOR_ACTIVEBOR DER = 10 'Border of active window

Const COLOR_INACTIVEB ORDER = 11 'Border of inactive window

Const COLOR_APPWORKSP ACE = 12 'Background of MDI desktop

Const COLOR_HIGHLIGHT = 13 'Selected item background

Const COLOR_HIGHLIGHT TEXT = 14 'Selected menu item

Const COLOR_BTNFACE = 15 'Button

Const COLOR_BTNSHADOW = 16 '3D shading of button

Const COLOR_GRAYTEXT = 17 'Grey text, of zero if dithering is used.

Const COLOR_BTNTEXT = 18 'Button text

Const COLOR_INACTIVEC APTIONTEXT = 19 'Text of inactive window

Const COLOR_BTNHIGHLI GHT = 20 '3D highlight of button

Const COLOR_2NDACTIVE CAPTION = 27 'Win98 only: 2nd active window color

Const COLOR_2NDINACTI VECAPTION = 28 'Win98 only: 2nd inactive window color

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click

Dim col As Long, t As Long

'Get the caption's active color

col = GetSysColor(COL OR_BACKGROUND)

'Change the active caption's color to red

t = SetSysColors(1, COLOR_BACKGROUN D, RGB(255, 0, 0))

MsgBox("The old title bar color was" + Str$(col) + " and is now" +
Str$(GetSysColo r(COLOR_ACTIVEC APTION)))

End Sub

Nov 21 '05 #10

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

Similar topics

42
2963
by: Frank Buss | last post by:
I've setup a challenge, mainly for C++, Java and Lisp, but every other language is welcome: http://www.frank-buss.de/challenge/index.html There is nothing to win, but I hope there will be some interesting solutions at the end, so the win are the results :-) -- Frank Buß, fb@frank-buss.de
8
1703
by: Frank Buss | last post by:
A new challenge: http://www.frank-buss.de/marsrescue/index.html Have fun! Now you can win real prices. -- Frank Buß, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
0
1206
by: Richard Jones | last post by:
The date for the second PyWeek challenge has been set: Sunday 26th March to Sunday 2nd April (00:00UTC to 00:00UTC). The PyWeek challenge invites entrants to write a game in one week from scratch either as an individual or in a team. Entries must be developed in Python, during the challenge, and must incorporate some theme chosen at the start of the challenge. REGISTRATION IS NOT YET OPEN --
0
1229
by: richard | last post by:
The date for the second PyWeek challenge has been set: Sunday 26th March to Sunday 2nd April (00:00UTC to 00:00UTC). The PyWeek challenge invites entrants to write a game in one week from scratch either as an individual or in a team. Entries must be developed in Python, during the challenge, and must incorporate some theme chosen at the start of the challenge. REGISTRATION IS NOW OPEN --
11
1663
by: CMM | last post by:
First let me say that maybe I'm having a "duh" moment and perhaps I'm missing something... but it seems to me that no one thing in the System.Collections namespace (even in .NET 2.0) even comes close to the still-useful-today VB intrinsic Collection. Here's the challenge (I know I'm totally missing something here).... Implement a full featured MRU (Most Recently Used) list using System.Collections. Use Case:
78
4582
by: wkehowski | last post by:
The python code below generates a cartesian product subject to any logical combination of wildcard exclusions. For example, suppose I want to generate a cartesian product S^n, n>=3, of that excludes '*a*b*' and '*c*d*a*'. See below for details. CHALLENGE: generate an equivalent in ruby, lisp, haskell, ocaml, or in a CAS like maple or mathematica. #------------------------------------------------------------------------------- # Short...
2
4700
by: donovan | last post by:
OK, so I know that there has been a lot of discussion on this topic, but none of the answers have been satisfactory. Therefore there seems to be only one thing to do: issue a challenge to all of the CSS gurus of the world to prove that CSS really can do what it claims to do. The challenge seems simple as first blush. We take a simple case of table-based layout: <table align="center" cellpadding="4">
3
1465
by: Thierry | last post by:
For those interested in <b>programming riddles</b>, I would like to announce a new programming challenge I'm just launching at http://software.challenge.googlepages.com This challenge is in its early stage and thus set to be continuously improved. I would be especially interested in your comments and feedbacks about this initiative and its relevance.
0
1326
by: Richard Jones | last post by:
The fifth PyWeek is only a month away. Come along and join the fun: write a video game in a week! There's some really interesting new libraries that have popped up recently. Have a gander on the pyweek message board for more info. REGISTRATION IS OPEN Visit the PyWeek website for more information:
80
3028
by: jacob navia | last post by:
Several people in this group argue that standard C is not portable since there are no compilers for it, etc. I propose this program in Standard C, that I have compiled in several OSes to test if this is actually true. My basic idea is to see which systems do not have a compiler that supports standard C. The program is designed to produce the sum of the natural integers up to a user provider argument. For instance
0
8402
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
8315
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
8734
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
8508
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
7341
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...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.