ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (05/07/91)
I am writing a graphical application - hence I am wondering how I should let the user specify colors... The program is an astronomy simulation/ graphing/simulation program. I suppose I can set up one dialog box for specifying the appearance of 16 colors (i.e. by specifying their RGB values). Then another dialog box would associate the colors with various objects (i.e. sun is color 1, stars are color 15, etc). However, is there a built-in way to do this (I'm dreading writing the code - which I expect won't be too bad). For example, the "colors" option of the control panel lets the user specify some colors, but I cannot find any routines to access those colors (I have Petzold, Guide to Programming, & Programmer's Reference). Let me know if you know of some routines that can get the RGB values of those colors... Another option that I'm entertaining is to give the users 16 colors that can't be changed. Is this feasible? I'm wondering if RGB(x, y, z) might be attractive on a VGA card, but unattractive or even invisible on a different (color) graphics card... Anyway, I'm looking forward to reading your suggestions! Terrell
dre@sequoia.cray.com (Dennis Ellis) (05/07/91)
In article <1991May7.011322.12743@mnemosyne.cs.du.edu> ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes: > >I am writing a graphical application - hence I am wondering how I should >let the user specify colors... The program is an astronomy simulation/ >graphing/simulation program. > I'm wondering the same thing. I sort of like the way Desktop/Colors option does it, and would love to find the code. I read on the net awhile back that there is a S/W Dev. Kit available from MS that provides assorted details and the code for a "Percent Complete Bar" (like that used during install). Does this same kit also contain color code? If anybody can shed some light on this, please let me know (enquiring minds want to know). -- ******************************************************************************* * Dennis Ellis (dre@sequoia.cray.com) * * * Cray Research, Inc. * * * Eagan, MN 55121 * All the normal stuff about opinions.. *
curt@cctb.wa.com (Curt Johnson) (05/08/91)
In article <1991May7.011322.12743@mnemosyne.cs.du.edu> ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes: | | I am writing a graphical application - hence I am wondering how I should | let the user specify colors... The program is an astronomy simulation/ | graphing/simulation program. | | I suppose I can set up one dialog box for specifying the appearance of | 16 colors (i.e. by specifying their RGB values). Then another dialog | box would associate the colors with various objects (i.e. sun is color 1, | stars are color 15, etc). I don't think there is a standard "get a color" dialog for windows. If you write something I hope it's better than just typing in R, G & B. | However, is there a built-in way to do this (I'm dreading writing the code - | which I expect won't be too bad). For example, the "colors" option of the | control panel lets the user specify some colors, but I cannot find any | routines to access those colors (I have Petzold, Guide to Programming, & | Programmer's Reference). Let me know if you know of some routines that | can get the RGB values of those colors... GetPrivateProfileString(); will read .INIs other than WIN.INI. You can get the custom colors from the [Custom Colors] section of CONTROL.INI. You will be getting a string of 6 hex characters that you have to convert to a long to use as a rgb color. It should be very simple to write this code. | Another option that I'm entertaining is to give the users 16 colors that | can't be changed. Is this feasible? I'm wondering if RGB(x, y, z) might | be attractive on a VGA card, but unattractive or even invisible on a different | (color) graphics card... I suspect that the 16 standard colors would be reasonable, unless you have better than standard VGA, that's all you have anyway. It depends on what is expected of the program. You should still allow your users to assign any color to any object. There are only minor problems (that I can think of) if you only use 16 colors. 1) Light gray is not available on EGA 2) On a b&w monitor, some colors map to black, some to white, you probably what the sky to be black and everything else to be white. 3) On a gray-scale monitor some colors will be difficult to distinguish (but only for colors with low contrast anyway). Curt Johnson == curt@cctb.wa.com
bonneau@hyper.hyper.com (Paul Bonneau) (05/08/91)
In article <1991May7.011322.12743@mnemosyne.cs.du.edu> ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes: > >However, is there a built-in way to do this (I'm dreading writing the code - >which I expect won't be too bad). For example, the "colors" option of the >control panel lets the user specify some colors, but I cannot find any >routines to access those colors (I have Petzold, Guide to Programming, & >Programmer's Reference). Let me know if you know of some routines that >can get the RGB values of those colors... > If I understand correctly, you simply want the RGB values of the system-wide colors set via the control panel? If so, do int clr; DWORD rgrgb[COLOR_ENDCOLORS - COLOR_SCROLLBAR + 1]; for (clr = COLOR_SCROLLBAR; clr <= COLOR_ENDCOLORS; clr++) rgrgb[clr - COLOR_SCROLLBAR] = GetSysColor(clr); cheers - Paul Bonneau.
ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (05/08/91)
You can order some documentation & code (the Windows Developer's Notes) that has code for a % complete bar (for use in software installation programs). However I don't think it includes any color specification software. I finally decided to bite the bullet and allow users to select colors for objects from a fixed pallette. Maybe I'll bite the bullet further and let them change the RGB values for the colors in the pallette... Not too difficult to write - but the color selection problem is solved so well in the Control Panel that it's a shame it can't be used for 3rd party appls too! Terrell
dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (05/08/91)
In article <917470ql@cctb.wa.com> curt@cctb.wa.com (Curt Johnson) writes: > >You should still allow your users to assign >any color to any object. > This is good advice, and is in the CUA guidelines (at least the version of them that Borland sends out with TPW). It makes me think there's must be a standard way to specify them - like an Options Color palette. In fact, Borland gives this menu entry in their sample menus in the CUA chapter. However, the built-in tools in Windows don't all have one. I've been dying to change the color of cross references in Winhelp from green to something else, but it doesn't look possible. So are these CUA guidelines worth anything, other than as general good advice about interfaces? Duncan Murdoch dmurdoch@watstat.waterloo.edu t
ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (05/08/91)
No, I'm not after the system colors because the objects in my program don't correspond to things like menu bars, window borders, etc. Instead, the objects are the sun, moon, stars, planets, galilean moons, etc. For now I'm working on a dialog box that will allow the user to select an object (e.g. the sun), and then specify a color from a static palette. Terrell
barry@gpu.utcs.utoronto.ca (Barry Lay) (05/08/91)
There is a discussion of setting colours in Windows applications in an old version of the Microsoft Systems Journal. I believe that it was in the July 1988 issue, but I am not sure as I don't have it in front of me. The article included source code for a palette tool that was similar to the control panel. The code might be available from the Microsoft area of Compu$erve. Barry