使用C#中的填写字段创建打印表单 [英] Create a Printing Form with Filling-in Fields in C#

查看:212
本文介绍了使用C#中的填写字段创建打印表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我正在使用Visual Studio C#WinForm工作一个小软件,从传感器(通过Arduino)收集数据,然后计算,显示,保存和打印。 ..打印部分有困难。实际上我已经设法以简单的方式做到了:



创建PrintDialog,PrintDocument

设置一些设置

然后PrintPageEventHandler(写一些文本并在那里画一些图)



但问题是它看起来不是很专业。我必须手动设置的所有大小和位置。

我正在尝试通过拖放创建类似报表的方法。在表单中输入的TextFields有一些字段,但如果您愿意,仍然可以编辑它。所有的位置和大小,页面设置,日期字段都可以使用鼠标设计。

然后当我按下打印时,所有字段都将被填充,显示在另一个真实的预览页面中打印按钮。



我尝试过Crystal Report,但需要设置数据库或使用datagridview提供数据集。相当复杂。也许它可以用简单的方式做,但我找不到任何合适的教程。

我想知道是否有任何简单的方法来执行这样的任务?



原谅我的英语,

非常感谢,

Hello,

I am working a small software using Visual Studio C# WinForm, collecting data from sensors (through Arduino) then calculate, display, save and print... I am having a difficulty with printing part. Actually i manage to do it in the simple way already:

Creating a PrintDialog, PrintDocument
Set some settings
Then PrintPageEventHandler (write some texts and draw some plots in there)

But the problem is it looks not very professional. All the sizes and positions I have to set manually.
I am trying to find a way to create something like a report with drag&drop. There are some fields which is feeded with the TextFields inputted in the Forms, but you can still edit it if you like. All the positions and sizes, page settup, date fields can be designed using mouse.
Then when I press "Print" for instance, all the fields will be filled, displayed in a preview page with another real printing button.

I have tried an Crystal Report but it need to set up a database or feed a dataset with datagridview. Quite complicated. Maybe it can do in simple way but I cannot find any appropriate tutorials to do so.
I wonder if there is any simple way to perform such task?

Pardon me for my English,
Thank you very much,

推荐答案

最后我找到了办法。我按照这里的步骤创建了一个没有数据库的数据集。



http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-without-database.htm [ ^ ]



然后在里面创建一个带有CrystalReportViewer的表单。将* .design.cs中的Access Modifier设置为internal,以便我可以在主窗体中使用。然后像在教程中一样设置源代码。



最后它很简单,但找到正确的教程非常耗时。我想我的搜索技能仍然不好或者这类报告主要针对数据库报告目的。



Gnurt,
Finaly I have found the way to do it. I followed the step in here to create a dataset without database.

http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-without-database.htm[^]

Then create a form with a CrystalReportViewer inside. Set its Access Modifier in *.design.cs to internal so that i can use in the main form. Then set source just as in the tutorial.

It is quite simple in the end, but quite time consuming to find the right tutorial. I guess my searching skill is still bad or these kinds of report aim mainly for database reporting purpose.

Gnurt,


这篇关于使用C#中的填写字段创建打印表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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