【问题标题】:Color difference between vista and Win7vista和win7的色差
【发布时间】:2011-07-08 15:51:23
【问题描述】:

有一个以图像形式显示在图形视口中的指示器。指示器可以是用户选择的任何颜色,因此我们使用调色板创建了一个图像,并使用以下代码将调色板中的特定颜色更改为用户选择的颜色。

    /// <summary>
    /// Copies the image and sets transparency and fill colour of the copy. The image is intended to be a simple filled shape such as a square
    /// with the inside all in one colour.
    /// </summary>
    /// <remarks>Assumes the fill colour to be changed is Red,
    /// black is the boundary colour and off white (RGB 233,233,233) is the colour to be made transparent</remarks>
    /// <param name="image"></param>
    /// <param name="fillColour"></param>
    /// <returns></returns>
    protected Bitmap CopyWithStyle(Bitmap image, Color fillColour)
    {
        ColorPalette selectionIndicatorPalette = image.Palette;

        int fillColourIndex = selectionIndicatorPalette.IndexOf(Color.Red);

        selectionIndicatorPalette.Entries[fillColourIndex] = fillColour;

        image.Palette = selectionIndicatorPalette;

        Bitmap tempImage = image;
        tempImage.MakeTransparent(transparentColour);
        return tempImage;
    }

说实话,我不确定这是否有点笨拙,是否有一些更聪明的方法,所以任何想法都会有所帮助。然而主要问题是这似乎在 Win7 上工作正常,但在 vista 和 XP 中颜色不会改变。有没有人见过这个。我发现一两篇文章表明它们之间的 ARGB 存在一些差异,但没有什么特别具体的。任何帮助都会被广泛接受。

【问题讨论】:

    标签: c# .net windows-7 colors windows-vista


    【解决方案1】:

    大家好,我们已经将它归结为 MakeTransparent 调用。我们已更改为使用透明 GIF 来避免此调用。可能一开始就应该这样做,因为它更有效。

    【讨论】:

    • 如果可以的话,我建议使用透明的 PNG,而不是 GIF。
    猜你喜欢
    • 2010-12-09
    • 2010-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-06
    • 2010-12-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多