如何打印数据网格视图C#GUI中的所有行 [英] How to print all the Row in Data Grid View C# GUI

查看:81
本文介绍了如何打印数据网格视图C#GUI中的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们



我有一个数据Gridview和一个按钮,试图在按钮点击时打印网格。因为我有正确的下面的代码,但这不打印所有的行只是pring那行在网格视图中是visibal更多行是谁可以查看向下滚动向上,所以我希望所有行和列打印



_____________________________________________________________________________________

位图bm =新位图(this.dataGridView1.Width,this.dataGridView1.Height); 
dataGridView1.DrawToBitmap(bm,new Rectangle(0,0,this.dataGridView1.Width,this.dataGridView1.Height));
e.Graphics.DrawImage(bm,150,400);



e.Graphics.DrawRectangle(Pens.Black,100,100,
dataGridView1.Columns [0] .Width,dataGridView1.Rows [0]。高度);


e.Graphics.FillRectangle(Brushes.LightGray,new Rectangle
(100,100,dataGridView1.Columns [0] .Width,dataGridView1.Rows [0] .Height ));



e.Graphics.DrawString(dataGridView1.Columns [0] .HeaderText,
dataGridView1.Font,Brushes.Black,new RectangleF(100,100,
dataGridView1.Columns [0] .Width,dataGridView1.Rows [0] .Height));



_____________________________________________________________________________________

解决方案

请帮助.....如何在datagridview中按位图打印所有行

Dear Firends

I have a data Gridview and one button and trying to print grid on button click. for i have right following code,but this is not printing all the row it is only pring that row who are visibal in grid view some more row are there who can view after scroll down and up so i want all row and column to be print

_____________________________________________________________________________________

Bitmap bm = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
            dataGridView1.DrawToBitmap(bm, new Rectangle(0, 0, this.dataGridView1.Width, this.dataGridView1.Height));
            e.Graphics.DrawImage(bm, 150, 400);
            
          

            e.Graphics.DrawRectangle(Pens.Black, 100, 100,
    dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height);

          
            e.Graphics.FillRectangle(Brushes.LightGray, new Rectangle
                (100, 100, dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height));

           

            e.Graphics.DrawString(dataGridView1.Columns[0].HeaderText,
                dataGridView1.Font, Brushes.Black, new RectangleF(100, 100,
                dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height)); 


_____________________________________________________________________________________

解决方案

help please..... how print all row by bitmap in datagridview


这篇关于如何打印数据网格视图C#GUI中的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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