using DevExpress.XtraPrinting;
using DevExpress.XtraPrintingLinks;
private void btnPrint_Click(object sender, EventArgs e)
{
Link link = new Link(this.printingSystem1);
printingSystem1.Links.Add(link);
link.CreateDetailArea += new CreateAreaEventHandler(this.link_CreateDetailArea);
printingSystem1.Links[0].CreateDocument();
printingSystem1.Document.AutoFitToPagesWidth = 1;
printingSystem1.Links[0].Print(printingSystem1.PageSettings.PrinterName);
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
void link_CreateDetailArea(Object sender, DevExpress.XtraPrinting.CreateAreaEventArgs e)
{
Rectangle rect = new Rectangle(Point.Empty, this.pictureEdit1.Image.Size);
//PrintcellHelperInfo info = new
DevExpress.XtraEditors.PrintCellHelperInfo info = new DevExpress.XtraEditors.PrintCellHelperInfo(Color.Empty, e.Graph.PrintingSystem, this.pictureEdit1.EditValue, this.pictureEdit1.Properties.Appearance, this.pictureEdit1.Text, rect, e.Graph);
e.Graph.DrawBrick((Brick)this.pictureEdit1.Properties.GetBrick(info), rect);
}