【紧急求助】关于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(); 关于扫描二维码识别问题 如何实现按快捷键自动下拉ComboBox控件内容? 求XML经典书籍 关闭窗体时,如何实现功能? 逐个读取数据表的信息??????? 水晶报表控件脱离编译器后运行失效 腾讯的浏览器浏览的时候,怎么session都共用了啊??急, VS2005对exe签名提示“对象已存在” 两个datatable合并 生成一个新的datatable 征求《C# Primer 中文版》电子书下载地址,分不是问题~ 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();