Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!microsoft!benw From: benw@microsoft.UUCP (Ben WALDMAN) Newsgroups: comp.sys.mac.programmer Subject: Re: Obtaining the Gray colour used for disabled menu items Message-ID: <72961@microsoft.UUCP> Date: 18 Jun 91 00:13:39 GMT References: <1991Jun14.141644.4857@bmers95.bnr.ca> Reply-To: benw@microsoft.UUCP (Ben WALDMAN) Organization: Microsoft Corp., Redmond WA Lines: 24 In article <1991Jun14.141644.4857@bmers95.bnr.ca> slang@bnr.ca (Steven Langlois) writes: >Under System 7, the gray of disabled items is a >nice solid gray, it doesn't look like a gray pattern applied to >solid black text. How can I draw a disabled item in the popup >box in the grey which is used for disabled menu items? To draw the system 7.0 style grayed text (used in menus and controls), do a TextMode(49) before your text drawing calls. To draw a grayed line, compute a color that is the arithmetic average of the foreground and background colors, computing each of the color components (R,G,B) separately (and make sure to use longword arithmetic to avoid overflow), and make this color your foreground color. The Textmode(49) call is simply a shortcut that does the math for you. Note that this does not always get you gray (i.e. use Kolor to get weird menu colors and see what happens), but the algorithm I describe is what System 7.0 does. Ben Waldman Excel Development Team Microsoft Corp. Disclaimer: These are my thoughts, opinions, and ideas, and in no way reflect those of my employer.