示例#1
0
        public static void RenderString(Graphics Graphics, string String, Text.Font Font, Color Color, int X, int Y)
        {
            if (String.Length > 0)
            {
                using (Bitmap b = new Bitmap(Font.MeasureString(String), Font.MaxHeight))
                {
                    int xpos = 0;
                    for (ushort i = 0; i < String.Length; i++)
                    {
                        Letter letter = Font.GetLetter(String[i]);
                        int    ypos   = Font.MaxHeight - letter.Height;

                        for (byte y = 0; y < letter.Height; y++)
                        {
                            for (byte x = 0; x < letter.Width; x++)
                            {
                                if (letter.Data[y * letter.Width + x])
                                {
                                    b.SetPixel(xpos + x, ypos + y, Color);
                                }
                            }
                        }

                        xpos += letter.Width + 1;
                    }
                    Graphics.DrawImage(b, X, Y);
                }
            }
        }
示例#2
0
 public static void RenderTitle(Graphics Graphics, string Title, Text.Font Font)
 {
     RenderString(Graphics, Title, Font, Color.White, 0, 0);
     Graphics.DrawLine(Pens.White, 0, 8, 127, 8);
 }