【紧急求助】关于winform下打印htm文件。 webbrowerser估计可以吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 IList area_list = 从数据路查出ILIST的数据 谢谢楼上,但是,因为直接是逻辑里面了,不想再做个form,再加webbrowerser 这样的做法。据说可以先绘图,再打印的方法,可是不知道怎么写。请高手帮忙。string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/word.html"; StringReader myReader = new StringReader(path); float linesPerPage = 0; float yPosition = 0; int count = 0; float leftMargin = e.MarginBounds.Left; float topMargin = e.MarginBounds.Top; string line = null; Font printFont = new Font("宋体", 15, FontStyle.Bold | FontStyle.Italic); SolidBrush myBrush = new SolidBrush(Color.Black); linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics); while (count < linesPerPage && ((line = myReader.ReadLine()) != null)) { yPosition = topMargin + (count * printFont.GetHeight(e.Graphics)); e.Graphics.DrawString(line, printFont, myBrush, leftMargin, yPosition, new StringFormat()); count++; } if (line != null) e.HasMorePages = true; else e.HasMorePages = false; myBrush.Dispose(); vs2008使用正则替换 gridview一列绑定多个字段 请教各位高手codedom系统找不到指定的文件的问题 能不能只用XML? 请教一下,abstract,override的问题. 求一个表格控件,能够显示交叉表 这个程序哪里错了,高手指教 ERP 和 MRP II是什么意思? 一个关闭窗体的问题,请各位指教 怎么把16进制的字符转化成字节 c# 导出excel后出现的奇怪问题,求助! 自定义控件中使用ToolStripProfessionalRenderer 是啥作用?
据说可以先绘图,再打印的方法,可是不知道怎么写。请高手帮忙。
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/word.html";
StringReader myReader = new StringReader(path);
float linesPerPage = 0;
float yPosition = 0;
int count = 0;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
string line = null;
Font printFont = new Font("宋体", 15, FontStyle.Bold | FontStyle.Italic);
SolidBrush myBrush = new SolidBrush(Color.Black);
linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);
while (count < linesPerPage && ((line = myReader.ReadLine()) != null))
{
yPosition = topMargin + (count * printFont.GetHeight(e.Graphics));
e.Graphics.DrawString(line, printFont, myBrush, leftMargin, yPosition, new StringFormat());
count++;
}
if (line != null)
e.HasMorePages = true;
else
e.HasMorePages = false;
myBrush.Dispose();