winform打印,自己设置打印纸张大小例如500*800px。急!!!!!
winform打印,自己设置打印纸张大小例如500*800px。应该怎么做呢?
网上的资料找到有:
using System.Drawing.Printing;
PrintDocument pd = new PrintDocument();
PaperSize p=null;
foreach(PaperSize ps in pd.PrinterSettings.PaperSizes)
{ if(ps.PaperName.Equals("A3"))
p = ps;
}
pd.DefaultPageSettings.PaperSize = p;
pd.Print();
pd.DefaultPageSettings.PaperSize = new PaperSize("自定义名称",宽,长)
但是我运行了没有用。
求救,急!!!!在线等~