Re: Map dithered color to nearest solid in 256 color mode?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tom Esh (tjeshGibberish_at_earthlink.net)
Date: 11/17/04


Date: Wed, 17 Nov 2004 14:12:15 -0500

On Wed, 17 Nov 2004 12:50:17 -0500, "Joseph Geretz"
<jgeretz@nospam.com> wrote:

>Our application implements a colored background, rather than the standard
>'battleship grey'. Normally, the application runs in a high-color mode and
>the forms look just fine. However, when the application is run in 256 color
>mode, the background is dithered and it doesn't look very nice.
>
>First question: Is there a way to set our forms up in the IDE to specify
>that the color should map to the nearest solid when running under 256 color
>mode? This would be the easiest solution.
>
>If not, I guess I can use the API to do this manually. I'll need to know how
>to detect the current color mode and then how to map a dithered color into
>the nearest solid color.

You could use GetNearestColor ...or let Ole do it for you when it
translates the value. Bit# 25 (value &H2000000) is the "no-dither"
flag.

Private Const OLE_NODITHER = &H2000000 'bit #25= no dither

ex:
Me.BackColor = RGB(217, 171, 87) Or OLE_NODITHER

You can also set the corresponding combined hex value directly in the
properties window at design time, though I would not recommend it. The
prop window color selector does not provide a way to set the flag
which makes it all to easy to strip it.

-Tom
MVP - Visual Basic
(please post replies to the newsgroup)



Relevant Pages

  • Re: Map dithered color to nearest solid in 256 color mode?
    ... >that the color should map to the nearest solid when running under 256 color ... prop window color selector does not provide a way to set the flag ...
    (microsoft.public.vb.general.discussion)
  • Re: farming honor in BGs
    ... I like that about WSG - it actually forces you to *do something* ... right change in tactics that breaks the stalemate - how many can you ... worth sacrificing their flag to get yours back if you have someone ... I watched the map and saw all of our players, ...
    (alt.games.warcraft)
  • Re: ID Sundry flotsam and jetsam.
    ... For some reason the "flag over map" motif reminds me of the liberation of somewhere or other but I can find your stamps in my Scott. ... Status of Chinese label types, ...
    (rec.collecting.stamps.discuss)
  • Re: Roadgeek Locator, Member Maps Feature - New at American Byways (beta)
    ... Clicking on it reveals the username of that person and their profile ... and the input map centered there but when I went back to the viewing map, ... It won't display a flag when you do that, although your coordinates are displayed in a text box below. ... Be sure to press submit when you are complete, and then browse over to the Member Maps feature. ...
    (misc.transport.road)