This is a migrated thread and some comments may be shown as answers.

RadDataEntry & RadPrintDocument

1 Answer 109 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 16 Oct 2014, 05:07 PM
Are there plans to have RadDataEntry implement the IPrintable interface so it can be used with RadPrintDocument?

1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 21 Oct 2014, 10:32 AM
Hi John,

Thank you for writing.

Currently, there we do not have plans to implement the IPrintable interface for RadDataEntry since we have not had users requesting such functionality. If we receive additional reports we will consider the possibility.

For the time being, you can manually implement the interface:
public class PrintableRadDataEntry : RadDataEntry, IPrintable
{
    #region IPrintable Members
 
    public int BeginPrint(RadPrintDocument sender, PrintEventArgs args)
    {
        return 1;
    }
 
    public bool EndPrint(RadPrintDocument sender, PrintEventArgs args)
    {
        return false;
    }
 
    public bool PrintPage(int pageNumber, RadPrintDocument sender, PrintPageEventArgs args)
    {
        Bitmap bmp = new Bitmap(this.Width, this.Height);
        this.DrawToBitmap(bmp, new Rectangle(Point.Empty, this.Size));
        args.Graphics.DrawImage(bmp, Point.Empty);
 
        return false;
    }
 
    public Form GetSettingsDialog(RadPrintDocument document)
    {
        return new PrintSettingsDialog(document);
    }
 
    public void Print()
    {
        RadPrintDocument doc = this.CreatePrintDocument();
        doc.Print();
    }
 
    public void PrintPreview()
    {
        RadPrintDocument doc = this.CreatePrintDocument();
        RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(doc);
        dialog.ThemeName = this.ThemeName;
        dialog.ShowDialog();
    }
 
    private RadPrintDocument CreatePrintDocument()
    {
        RadPrintDocument doc = new RadPrintDocument();
        doc.AssociatedObject = this;
        return doc;
    }
 
    #endregion
}

You can then call the relevant methods.

I hope this helps.

Regards,
George
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
John
Top achievements
Rank 1
Answers by
George
Telerik team
Share this question
or