c#关于Datagridview打印问题

liangzhl 2009-11-15 09:53:42
Font font = new Font("Tahoma", 16, FontStyle.Regular);//设置画笔
Font font2 = new Font("宋体", 25, FontStyle.Bold);
Brush bru = Brushes.Blue;
Pen pen = new Pen(bru);
Graphics g = e.Graphics;
pen.Width = 1;
//设置各边距

int nLeft = e.PageSettings.Margins.Left;
int nTop = e.PageSettings.Margins.Top;
int nRight = e.PageSettings.Margins.Right;
int nBottom = e.PageSettings.Margins.Bottom;
int nWidth = e.PageSettings.PaperSize.Width - nRight - nLeft;
int nHeight = e.PageSettings.PaperSize.Height - nTop - nBottom;
//打印各边距
//e.Graphics.DrawLine(pen, nLeft, nTop, nLeft, nTop + nHeight);
//e.Graphics.DrawLine(pen, nLeft+nWidth, nTop, nLeft+nWidth, nTop + nHeight);
//e.Graphics.DrawLine(pen, nLeft, nTop, nLeft+nWidth, nTop);
//e.Graphics.DrawLine(pen, nLeft, nTop+nHeight, nLeft + nWidth, nTop+nHeight);
//在离左边距20,右边距20的位置打印haha xixi

g.DrawString("haha xixi:", font, bru, nLeft + 20, nTop + 100);//如果要打印datagridView在这里遍历便可

是自己画的一个表格然后直接打印出来,请问怎么个遍历啊?
...全文
72 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
liangzhl 2009-11-20
  • 打赏
  • 举报
回复
都这么久了,我自己也解决了,还是没人回啊,我这分给谁呢。
zl194 2009-11-16
  • 打赏
  • 举报
回复
意思应当是取datagridview的每个单元的值,替换里面的文本。
liangzhl 2009-11-15
  • 打赏
  • 举报
回复
没人会吗????????

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧