Completed
Last Updated: 05 Jun 2014 07:07 by ADMIN
ADMIN
Peter
Created on: 09 Sep 2013 07:44
Category: UI Framework
Type: Bug Report
0
FIX. PrintSettings dialog crash if Printer's SourceName is empty.
PrintSettings dialog crash if Printer's SourceName is empty.
Workarround: Enumerate printers and set a name for empty Source Names.

class MyPrintSettingDialog : PrintSettingsDialog
{
    public MyPrintSettingDialog(RadPrintDocument document):base(document)
    { }
    public MyPrintSettingDialog():base()
    { }
 
    protected override void LoadSettings()
    {
        PrinterSettings.PaperSourceCollection paperSourceCollection = this.PrintDocument.PrinterSettings.PaperSources;
        int index = 0;
        while (index < paperSourceCollection.Count)
        {
            if (string.IsNullOrEmpty(paperSourceCollection[index].SourceName) || paperSourceCollection[index].SourceName == "-1")
            {
                paperSourceCollection[index].SourceName = "NONEMPTY NAME";                    
            }
             
            index++;
        }
 
        base.LoadSettings();
    }
}
0 comments