上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 85 下一页
  2013年9月6日
摘要: 最方便的用法:private void ViewMsg(string msg) {/*control.Invoke(newSetControlTextDelegate((ct,v)=>{ct.Text=v;}),newobject[]{control,value});=>control.Invoke(newAction((ct,v)=>{ct.Text=v;}),newobject[]{control,value});*/ this.rtb.Invoke(new Action((ct, v) => { ct.AppendText(v); ct.Refresh(); }) 阅读全文
posted @ 2013-09-06 22:41 武胜-阿伟 阅读(597) 评论(0) 推荐(0) 编辑
摘要: 问题是这样的,打印机使用的是卷筒的连续纸,要打印的内容因为数据行数不同,高度会有变化。这时如果能在打印时动态改变纸张大小(其实只改变高度即可)当然是最好的选择。我使用了网上久负盛名的[长江支流]的“金质打印通”做为打印控件,挺好用的。不过并不支持动态设置纸张。每次打印都使用对话框让用户进行设置肯定是不行的。所有的代码,都是围绕“金质打印通”的CS版的OpenedCodes下的MisGoldPrinter类的构造函数展开的。下面是原始代码,供参考。 public MisGoldPrinter(bool p_IsLandscape) { PrinterSingleton.Reset(); mCur 阅读全文
posted @ 2013-09-06 21:23 武胜-阿伟 阅读(1656) 评论(0) 推荐(0) 编辑
摘要: using System.Drawing.Printing;using System.Drawing;private void Test(){ PrintDocument m_pdoc = new PrintDocument(); PaperSize psz = new PaperSize(); m_pdoc.PrinterSettings.PrinterName = "Microsoft Office Document Image Writer"; psz.RawKind = 0;// Printing.PaperKind.Custom此枚举的值是0 psz.W... 阅读全文
posted @ 2013-09-06 21:20 武胜-阿伟 阅读(2739) 评论(0) 推荐(0) 编辑
摘要: .Net 提供的打印类PrintDocument 非常简洁易用,不过在实际应用开发中往往需要对纸张进行自定义,尤其是需要进行票据打印时。这个问题也困扰了我许久,经过查阅相关的资料和多次尝试,发现 其实也很简单。下面的示例就是我在.Net2.0已经验证可行的办法:using System;using System.Collections.Generic;using System.Text;using System.Drawing;using System.Drawing.Printing;namespace PrintService{ class AFCSPrinter : { ... 阅读全文
posted @ 2013-09-06 21:13 武胜-阿伟 阅读(3793) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows. 阅读全文
posted @ 2013-09-06 21:07 武胜-阿伟 阅读(28289) 评论(0) 推荐(0) 编辑
摘要: System.Drawing.Printing.PrintDocument doc = new PrintDocument(); doc.PrinterSettings.PrinterName = "NFCP LQ1600K"; int rawKind = 1; for (int i = 0; i <= doc.PrinterSettings.PaperSizes.Count - 1; i++ ) { if (doc.PrinterSettings.PaperSizes[i... 阅读全文
posted @ 2013-09-06 21:03 武胜-阿伟 阅读(4645) 评论(1) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Drawing.Printing;namespace PrintDemo{ /// /// 开发者:无名剑 /// 网站:www.west163.net /// QQ:16349023 /// Email:admin@xo68... 阅读全文
posted @ 2013-09-06 21:02 武胜-阿伟 阅读(2501) 评论(0) 推荐(0) 编辑
摘要: using System.Drawing.Printing.PrintDocumentusing System.Drawing.Printing.PrinterSettings.PaperSizeCollectionusing System.Drawing.Printing.PaperSizeusing System.Drawing.Printing.PageSettings/////////需要以上引用PrintDocument pd = new PrintDocument();PaperSize p=null;foreach(PaperSize ps in pd.PrinterSettin 阅读全文
posted @ 2013-09-06 21:00 武胜-阿伟 阅读(12884) 评论(1) 推荐(0) 编辑
摘要: void PrintButtonClick(object sender, EventArgs e) { PrintPreviewDialog dlg = new PrintPreviewDialog(); //page setting PageSetupDialog psp = new PageSetupDialog(); psp.AllowMargins = true; SourceGrid.Exporter.GridPrintDocument... 阅读全文
posted @ 2013-09-06 20:58 武胜-阿伟 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 1.启用页边距:默认情况下PrintDocument是不理会页边距的(MS再次让人无语。。。),这也是为什么有人说明明设了页边距在打印预览里却没有效果的原因。解决办法是设置PrintDocument对象的OriginAtMargins属性为True,如下:printDocument1.OriginAtMargins=true;//启用页边距再来看一下从元数据中提取的关于OriginAtMargins属性的定义: ////摘要://获取或设置一个值,该值指示与页关联的图形对象的位置是位于用户指定边距内,还是位于该页可打印区域的左上角。////返回结果://如果图形起始于页面边距,则为true;如 阅读全文
posted @ 2013-09-06 20:56 武胜-阿伟 阅读(953) 评论(0) 推荐(0) 编辑
上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 85 下一页