Beispiel #1
0
        private static void Load_emotic()
        {
            DirectoryInfo di = new DirectoryInfo(Settings.AppPath + "emoticons");

            FileInfo[] files = di.GetFiles();
            ex_emotic = new ExtendedEmoticon[files.Length];

            for (int i = 0; i < files.Length; i++)
            {
                using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(files[i].FullName)))
                    using (Bitmap raw = new Bitmap(ms))
                    {
                        ExtendedEmoticon ex = new ExtendedEmoticon();
                        ex.Img = new Bitmap(raw.Width, raw.Height);

                        using (Graphics g = Graphics.FromImage(ex.Img))
                            g.DrawImage(raw, new Point(0, 0));

                        ex.ShortcutText = Path.GetFileNameWithoutExtension(files[i].Name).ToUpper();
                        ex.Height       = ex.Img.Height;
                        ex_emotic[i]    = ex;
                    }
            }

            emotic = new Bitmap[49];
            int       count = 0;
            Rectangle r1    = new Rectangle(0, 0, 16, 16);
            Rectangle r2    = new Rectangle(0, 0, 16, 16);

            using (Bitmap raw = Properties.Resources.emotic)
            {
                for (int y = 0; y < 7; y++)
                {
                    for (int x = 0; x < 7; x++)
                    {
                        emotic[count] = new Bitmap(16, 16);
                        r2.X          = (x * 16);
                        r2.Y          = (y * 16);

                        using (Graphics g = Graphics.FromImage(emotic[count]))
                            g.DrawImage(raw, r1, r2, GraphicsUnit.Pixel);

                        emotic[count].MakeTransparent(Color.Magenta);
                        count++;
                    }
                }
            }

            Emoji.Load();
        }