在C#VS 2013中从DataGridView打印POS [英] POS Printing from DataGridView in C# VS 2013

查看:117
本文介绍了在C#VS 2013中从DataGridView打印POS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在为服装展厅开发POS应用程序。设计部分完成,一切正常。现在我需要打印。我必须打印到POS打印机连接到运行该软件的计算机的收据,我想打印DataGridView表中显示的项目,格式就像我在模拟图像文件中附加的那样。



DataGridView表截图: http://img237.imagevenue.com/img.php?image=51739_Slip01_122_174lo.jpg [ ^ ]



模拟图像收据: http://img247.imagevenue.com/img.php?image=51740_Slip02_122_105lo.jpg [ ^ ]



现在的问题是我对POS Printi的了解不多来自DataGridView Table或类似的东西。

任何打印类似这样或任何相关指南的教程都会非常感激。

Hello, I am in development of a POS Application for a Garments Showroom. The design part is done and Everything works fine. Now I need to print. I have to print to a money receipt with a POS Printer connected to the computer running the software and I wanted to print the Items shown in the DataGridView Table in a format like I have attached in the simulated Image file.

DataGridView Table Screenshot: http://img237.imagevenue.com/img.php?image=51739_Slip01_122_174lo.jpg[^]

A Simulated Image Receipt: http://img247.imagevenue.com/img.php?image=51740_Slip02_122_105lo.jpg[^]

Now the problem is I don't know that much about POS Printing from DataGridView Table or something like this.
Any tutorial to print something like this or any related guideline would be much appreciated.

推荐答案

您只需创建具有相同图像收据设计的表单。然后将数据传递给表单打印表格如:

You only have to create a form with the same design of image receipt. Then pass the data to the form print the form like:
private PrintDocument printDocument1 = new PrintDocument();

public Form1()
{
    InitializeComponents();
    printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
    this.Controls.Add(printButton);
    CaptureScreen();
    printDocument1.Print();
}


Bitmap memoryImage;

private void CaptureScreen()
{
    Graphics myGraphics = this.CreateGraphics();
    Size s = this.Size;
    memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
    Graphics memoryGraphics = Graphics.FromImage(memoryImage);
    memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}

private void printDocument1_PrintPage(System.Object sender,
       System.Drawing.Printing.PrintPageEventArgs e)
{
    e.Graphics.DrawImage(memoryImage, 0, 0);
}



我不知道你的数据是什么,你可以用不同的方式传递数据。您可以向我提供源代码,我可以提供更好的帮助。


I don't know what is your data and you can pass the data using different ways. You may provide me the source code and I may be able to help better.


大多数POS打印机都支持由EPSON开发的ESC / POS打印机命令。您必须学习ESC / POS,然后生成要发送到打印机的命令。您可以使用此代码从.NET应用程序发送原始打印机命令。
Most POS printers do support ESC/POS printer commands which was developed by EPSON. You have to learn ESC/POS and then generate the commands to be sent to the printer. You can use this code to send raw printer commands from your .NET app.


这篇关于在C#VS 2013中从DataGridView打印POS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆