我正在将控件转换为位图并将其打印出来:
using (MemoryStream ms = new MemoryStream())
{
chart1.SaveImage(ms, ChartImageFormat.Bmp);
Bitmap bm = new Bitmap(ms);
PrintDocument doc = new PrintDocument();
doc.PrintPage += (s, ev) =>
{
ev.Graphics.DrawImage(bm, Point.Empty); // adjust this to put the image elsewhere
ev.HasMorePages = false;
};
doc.Print();
}
如何指定以横向打印?
答案 0 :(得分:12)
doc.DefaultPageSettings.Landscape = true;
http://msdn.microsoft.com/en-us/library/system.drawing.printing.pagesettings.landscape.aspx
答案 1 :(得分:4)
通过PrintDocument.DefaultPageSettings
可浏览的属性。
PrintDocument.DefaultPageSettings.Landscape = true;
因此,对于您的代码示例,这将是:
doc.DefaultPageSettings.Landscape = true;