示例#1
0
        private void drawLine(Graphics g)
        {
            Bitmap bmp = new Bitmap(576, 50);

            g = Graphics.FromImage(bmp);
            g.DrawLine(Pens.White, 0, 50, 286, 50);
            g.Dispose();
            ESCPOS.PrintFixedImage(bmp);

            //bmp.Save("C:\\github\\TestPrint\\TestPrint\\bin\\Debug\\g8.jpg");
            bmp.Dispose();
        }
示例#2
0
        private void drawFourthLineString(Graphics g, String str)
        {
            Bitmap bmp = new Bitmap(576, 30 * 4);

            g = Graphics.FromImage(bmp);
            Font font = new Font("宋体", 24, GraphicsUnit.Pixel);

            g.DrawString(str, font, Brushes.White, new Rectangle(0, 0, 576, 30 * 4));
            g.Dispose();
            ESCPOS.PrintFixedImage(bmp);

            // bmp.Save("C:\\github\\TestPrint\\TestPrint\\bin\\Debug\\g9.jpg");
            bmp.Dispose();
        }
示例#3
0
        private void drawPrint(Graphics g, StringFormat fmt, String name, String count, String unit)
        {
            Bitmap bmp = new Bitmap(576, 32);

            g = Graphics.FromImage(bmp);
            Font font = new Font("宋体", 24, GraphicsUnit.Pixel);

            g.DrawString(name, font, Brushes.White, new Rectangle(0, 0, 32 * name.Length, 32));
            g.DrawString(count, font, Brushes.White, new Rectangle(576 - 32 * count.Length - unit.Length * 32, 0, 32 * count.Length, 32), fmt);
            g.DrawString(unit, font, Brushes.White, new Rectangle(576 - 32, 0, unit.Length * 32, 32));
            g.Dispose();
            ESCPOS.PrintFixedImage(bmp);

            //bmp.Save("C:\\github\\TestPrint\\TestPrint\\bin\\Debug\\g8.jpg");
            bmp.Dispose();
        }