Exemplo n.º 1
0
        public static void DrawIcon(
            object sender, DrawItemEventArgs e, Preview preview, int iconIndex,
            Fonts.Glyph[] font, int[] palette, bool shadow, Bitmap bgimage)
        {
            // set the pixels
            var temp = preview.GetPreview(font, palette,
                                          new char[] { (char)(e.Index + iconIndex) }, shadow, false);

            int[] pixels = new int[256 * 14];
            for (int y = 0, c = 0; y < 14; y++, c++)
            {
                for (int x = 2, a = 0; x < 256; x++, a++)
                {
                    pixels[y * 256 + x] = temp[c * 256 + a];
                }
            }
            if (bgimage != null)
            {
                var background = new Rectangle(0, e.Index * 15 % bgimage.Height, bgimage.Width, 15);
                e.Graphics.DrawImage(bgimage, e.Bounds.X, e.Bounds.Y, background, GraphicsUnit.Pixel);
            }
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                e.DrawBackground();
            }
            e.Graphics.DrawImage(Do.PixelsToImage(pixels, 256, 14), new Point(e.Bounds.X, e.Bounds.Y));
        }
Exemplo n.º 2
0
        public static void DrawName(
            object sender, DrawItemEventArgs e, Preview preview, string[] names,
            Fonts.Glyph[] font, int[] palette, int xOffset, int yOffset,
            int startIndex, int endIndex, bool lastEmpty, bool shadow, Bitmap bgimage)
        {
            if (e.Index < 0 || e.Index >= names.Length)
            {
                return;
            }
            string name = names[e.Index];

            // set the pixels
            var temp   = preview.GetPreview(font, palette, name.ToCharArray(), shadow, false);
            var pixels = new int[256 * 32];

            for (int y = 0, c = yOffset; y < 14; y++, c++)
            {
                for (int x = 2, a = xOffset; x < 256; x++, a++)
                {
                    pixels[y * 256 + x] = temp[c * 256 + a];
                }
            }
            if (bgimage != null)
            {
                var background = new Rectangle(0, e.Index * 16 % bgimage.Height, bgimage.Width, 16);
                e.Graphics.DrawImage(bgimage, e.Bounds.X, e.Bounds.Y, background, GraphicsUnit.Pixel);
            }
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                e.DrawBackground();
            }
            if (lastEmpty && e.Index == names.Length - 1)
            {
                e.Graphics.DrawString("*** NOTHING ***", new Font("Arial Black", 7F), Brushes.White, e.Bounds.Location);
            }
            else
            {
                e.Graphics.DrawImage(Do.PixelsToImage(pixels, 256, 15), e.Bounds.Location);
            }
        }
Exemplo n.º 3
0
        public static void DrawText(string text, int x, int y, Graphics g, Preview preview, Fonts.Glyph[] font, int[] palette)
        {
            var temp = preview.GetPreview(font, palette, text.ToCharArray(), false, false);

            g.DrawImage(Do.PixelsToImage(temp, 256, 14), x, y);
        }