示例#1
0
        public static int MeasureString(LCDBitmapFont font, string txt, int spacing = 1)
        {
            int width = 0;
            for (int i = 0; i < txt.Length; i++)
            {
                string chr = txt.Substring(i, 1);

                LCDBitmap charbmp = font.Characters[chr];
                width += charbmp.Width + spacing;
            }
            return width;
        }
示例#2
0
        public void DrawString(int px, int py, LCDBitmapFont font, string txt, int spacing = 1)
        {
            int posx = px;
            for (int i = 0; i < txt.Length; i++)
            {
                string chr = txt.Substring(i, 1);

                LCDBitmap charbmp = font.Characters[chr];
                DrawLCDBitmap(charbmp, 0, 0, posx, py, charbmp.Width, charbmp.Height);
                posx += charbmp.Width + spacing;
            }
        }