我下載了一套VS2015圖標,並通過MSDN guideVS2015圖標指南 - 顏色反轉
在閱讀「使用圖像中的顏色」,它指出,「爲了使圖標顯示正確的對比度在Visual Studio的黑暗主題中,反轉是以編程方式應用的「
我試圖在我的應用程序中模仿這種行爲,但是當我對圖像應用顏色反轉時,它不會出現它的方式看起來在VS的黑暗主題:
有誰知道VS如何反轉顏色,所以我可以模仿這個?
編輯: 這是我使用的反碼 - 這個問題似乎與透明度/阿爾法邊緣:
public static void InvertColors(Bitmap bitmapImage)
{
var bitmapRead = bitmapImage.LockBits(new Rectangle(0, 0, bitmapImage.Width, bitmapImage.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
var bitmapLength = bitmapRead.Stride * bitmapRead.Height;
var bitmapBGRA = new byte[bitmapLength];
Marshal.Copy(bitmapRead.Scan0, bitmapBGRA, 0, bitmapLength);
bitmapImage.UnlockBits(bitmapRead);
for (int i = 0; i < bitmapLength; i += 4)
{
bitmapBGRA[i] = (byte)(255 - bitmapBGRA[i]);
bitmapBGRA[i + 1] = (byte)(255 - bitmapBGRA[i + 1]);
bitmapBGRA[i + 2] = (byte)(255 - bitmapBGRA[i + 2]);
}
var bitmapWrite = bitmapImage.LockBits(new Rectangle(0, 0, bitmapImage.Width, bitmapImage.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppPArgb);
Marshal.Copy(bitmapBGRA, 0, bitmapWrite.Scan0, bitmapLength);
bitmapImage.UnlockBits(bitmapWrite);
}
你能告訴我們一些代碼,顯示到目前爲止你已經嘗試了什麼? Visual Studio的源代碼是專有的,所以你不可能找到任何能夠告訴你它在源代碼方面如何工作的人。 –