As strange as it seems, Visual Studio is having problems with XP icons. I assume, you are trying to use the icon from a .net language using form designer.
The bug description and a not very satisfactory workaround is here: http://support.microsoft.com/kb/822488/en-us
I would recommend to export the icon image as png and load the png into the form designer instead of the icon or use the following code to load icon correctly:
public class IconLoader
{
[DllImport("user32.dll", SetLastError=true)]
static extern int DestroyIcon(IntPtr hIcon);
[DllImport("user32.dll")]
static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo);
public struct ICONINFO
{
public bool fIcon;
public int xHotspot;
public int yHotspot;
public IntPtr hbmMask;
public IntPtr hbmColor;
}
static public Bitmap DataToAlphaBitmap(byte[] a_data, int sizeX, int sizeY)
{
using (Icon i = new Icon(new System.IO.MemoryStream(a_data, false), sizeX, sizeY))
{
return IconToAlphaBitmap(i);
}
}
static public Bitmap IconToAlphaBitmap(Icon ico)
{
ICONINFO ii = new ICONINFO();
GetIconInfo(ico.Handle, out ii);
Bitmap bmp = Bitmap.FromHbitmap(ii.hbmColor);
DestroyIcon(ii.hbmColor);
DestroyIcon(ii.hbmMask);
if (Bitmap.GetPixelFormatSize(bmp.PixelFormat) < 32)
return ico.ToBitmap();
BitmapData bmData;
Rectangle bmBounds = new Rectangle(0,0,bmp.Width,bmp.Height);
bmData = bmp.LockBits(bmBounds,ImageLockMode.ReadOnly, bmp.PixelFormat);
Bitmap dstBitmap=new Bitmap(bmData.Width, bmData.Height, bmData.Stride, PixelFormat.Format32bppArgb, bmData.Scan0);
bool IsAlphaBitmap = false;
for (int y=0; y <= bmData.Height-1; y )
{
for (int x=0; x <= bmData.Width-1; x )
{
Color PixelColor = Color.FromArgb(Marshal.ReadInt32(bmData.Scan0(bmData.Stride * y) (4 * x)));
if (PixelColor.A > 0 & PixelColor.A < 255)
{
IsAlphaBitmap = true;
break;
}
}
if (IsAlphaBitmap) break;
}
bmp.UnlockBits(bmData);
if (IsAlphaBitmap==true)
return new Bitmap(dstBitmap);
else
return new Bitmap(ico.ToBitmap());
}
}