예제 #1
0
        public void loadGameIcon(String game, out Bitmap result)
        {
            try
            {
                String resource = "GameserverPanel.Resources."+game+".ico";
                Stream resStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource);
                if (resStream == null)
                {
                    result = new Bitmap(1, 1);
                    result.SetPixel(0, 0, Color.White);
                    return;
                }
                result = new Icon(resStream, 16, 16).ToBitmap();

                Color c;
                Color t = Color.FromArgb(0,0,0,0);

                for (int x=0; x<result.Width; x++)
                {
                    for (int y=0; y<result.Height; y++)
                    {
                        c = result.GetPixel(x, y);
                        if (c == t)
                            result.SetPixel(x, y, Color.White);
                    }
                }
            }
            catch (Exception E)
            {
                result = new Bitmap(1, 1);
                result.SetPixel(0, 0, Color.White);
                Log.Error("loadGameIcon(): "+E.Message);
            }
        }