如何打印实验报告? [英] How to print a lab report?

查看:348
本文介绍了如何打印实验报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int y = 365;
            for (int i = NumberofItemsperpagesofar; i < dataGridView1.Rows.Count; i++)
            {

               
                NumberofItemsperpage++;
                if (NumberofItemsperpage <= 10)
                {
                    NumberofItemsperpagesofar++;
                    if (NumberofItemsperpagesofar <= dataGridView1.Rows.Count)
                    {
                        Pen m = new Pen(Brushes.Black, 2.5f);
                        // e.Graphics.DrawString(dataGridView1.Rows[i].Cells[0].Value.ToString(), new Font("Microsoft Sans Serif", 16, FontStyle.Regular), Brushes.Black, new Point(15, y - 4));
                        try
                        {
                            if (dataGridView1.Rows[i].Cells[0].Value == dataGridView1.Rows[i].Cells[0].Value)
                            {
                                e.Graphics.DrawString(dataGridView1.Rows[0].Cells[0].Value.ToString(), new Font("Times New Roman", 18, FontStyle.Bold), Brushes.Black, new Point(10, 355));

                                // e.Graphics.DrawLine(q, new Point(0, y + 24), new Point(1000, y + 24));
                                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[1].Value.ToString(), new Font("Calibri", 15, FontStyle.Bold), Brushes.Black, new Point(7, y+ 17));
                                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[4].Value.ToString(), new Font("Calibri", 16, FontStyle.Bold), Brushes.Black, new Point(310, y +17));
                                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[3].Value.ToString(), new Font("Calibri", 16, FontStyle.Bold), Brushes.Black, new Point(545, y +17));
                                e.Graphics.DrawString(dataGridView1.Rows[i].Cells[2].Value.ToString(), new Font("Calibri", 16, FontStyle.Bold), Brushes.Black, new Point(690, y +17));
                            }
                           else if (dataGridView1.Rows[i].Cells[0].Value != dataGridView1.Rows[i].Cells[0].Value)
                            {
                                e.Graphics.DrawString(dataGridView1.Rows[0].Cells[0].Value.ToString(), new Font("Times New Roman", 18, FontStyle.Bold), Brushes.Black, new Point(10, y+25));
                            }
                        }
                        catch (Exception ex) { MessageBox.Show(ex.Message); }
                        y += 30;
                    }
                    else
                    {
                        e.HasMorePages = false;
                    }
                }
                else
                {
                    NumberofItemsperpage = 0;
                    e.HasMorePages = true; return;
                }
            }





我的尝试:



i想要每次打印一次单元格[0]值和所有其他单元格,当单元格[0]值发生变化然后重新打印时请帮我解决这个问题



What I have tried:

i want to print cell[0] value one time and all other cells every time and when cell[0] value change then print again please help me to solve this problem

推荐答案

为什么不使用水晶报告?图形方式有点乏味



这里有一些关于如何在C中使用水晶报告的链接#



< a href =https://www.codeproject.com/Questions/157453/how-to-include-Crystal-Report-Runtime-in-my-packag>如何在我的软件包和部署项目中包含Crystal Report Runtime? [ ^ ]



C#Crystal Reports一步一步 [ ^ ]



c# - 如何在部署中将Crystal Report包含到WIX中? - 堆栈溢出 [ ^ ]



c# - 如何使用crystal report先决条件创建.NET安装项目? - 堆栈溢出 [ ^ ]
Why don't you use crystal report? Graphics way is bit tedious

Here are some links on how to use crystal report in C#

how to include Crystal Report Runtime in my package and deployment project ?[^]

C# Crystal Reports step by step[^]

c# - How to Include Crystal Report Into WIX On Deployment? - Stack Overflow[^]

c# - How to create a .NET setup project with crystal report prerequisite? - Stack Overflow[^]


这篇关于如何打印实验报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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