Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# vista和Win7之间的色差_C#_.net_Windows 7_Colors_Windows Vista - Fatal编程技术网

C# vista和Win7之间的色差

C# vista和Win7之间的色差,c#,.net,windows-7,colors,windows-vista,C#,.net,Windows 7,Colors,Windows Vista,在图形视口中显示图像形式的指示器。指示器可以是用户选择的任何颜色,因此我们使用托盘创建了一个图像,并使用以下代码将托盘中的特定颜色更改为用户选择的颜色 /// <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 ///

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

    /// <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;
    }
//
///复制图像并设置副本的透明度和填充颜色。图像是一个简单的填充形状,如正方形
///和内部都在一个颜色。
/// 
///假设要更改的填充颜色为红色,
///黑色是边界颜色,灰白色(RGB 233)是透明的颜色
/// 
/// 
/// 
受保护的位图CopyWithStyle(位图图像、颜色填充颜色)
{
ColorPalette selectionIndicatorPalette=image.palete;
int fillcolorIndex=selectionIndicatorPalette.IndexOf(Color.Red);
selectionIndicatorPalette.Entries[FillColor Index]=FillColor;
image.palete=选择指示灯或调色板;
位图tempImage=图像;
tempImage.MakeTransparent(透明色);
返回图像;
}

老实说,我不确定这是否有点笨拙,是否有更聪明的方法,所以任何想法都会有所帮助。然而,主要的问题是,这似乎在Win7上运行良好,但在vista和XP中,颜色不会改变。以前有人见过吗。我发现一两篇文章表明它们之间的ARGB有一些不同,但没有什么特别具体的内容。非常感谢您的帮助。

大家好,我们已将其落实到MakeTransparent通话中。我们已改为使用透明GIF以避免此调用。本来应该这样做的,因为它更高效。

大家好,我们已经把它固定在MakeTransparent调用上了。我们已改为使用透明GIF以避免此调用。首先,我可能应该这样做,因为它更有效。

我建议使用透明PNG,而不是GIF,如果这是一个选项的话。我建议使用透明PNG,而不是GIF,如果这是一个选项的话。