免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項超值服

開通VIP
C#打印dataGridView中的數(shù)據(jù)


這幾天,我研究了以下C#如何打印dataGridView中的數(shù)據(jù),在網(wǎng)上、圖書館搜索和查閱了一些內(nèi)容,現(xiàn)總結(jié)一下:

//執(zhí)行打印窗體中的數(shù)據(jù)操作

private void toolStripButton2_Click(object sender, EventArgs e)
        {

            printDialog1.ShowDialog();  //設(shè)置打印文檔
            printPreviewDialog1.Document = this.printDocument1;
            printPreviewDialog1.ShowDialog();
        }

//在窗體中繪制要打印的數(shù)據(jù)

private void printDocument1_PrintPage(object sender,System.Drawing.Printing.PrintPageEventArgs e)
        {
            //e.Graphics.DrawString(dataGridView1.Columns.ToString(), new Font("宋體", 10, FontStyle.Regular), Brushes.Black, 260, 400);
          
            int r = 0;
            int c = 20;
            for(int i=0;i<dt.Rows.Count;i++)
            {
              
                for(int j=0;j<dt.Columns.Count;j++)
                {
                  
                    e.Graphics.DrawString(dt.Rows[i][j].ToString(), new Font("宋體", 10, FontStyle.Regular), Brushes.Black, r, c);
                    r = r + 60;
                   
                }
                r = 0;
                c += 20;
               
            }
        }

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
DataGridView 多線程更新 數(shù)據(jù) 解決卡頓問題
c#winform中,對DataGridView數(shù)據(jù)進(jìn)行操作,一次性保存
datagridview 的selectionMode設(shè)置為fullColumnselecte時,列的sortMode不能設(shè)置為automatic
關(guān)于DataGridView_DataError事件的問題
C#DataGridView格式化顯示單元格的內(nèi)容
141.圖形法繪制橢圓
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服