예제 #1
0
        private void btnSelectDefault_Click(object sender, EventArgs e)
        {
            Stream stream = null;

            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(PrintSetting));
                stream = File.Open(Application.StartupPath + @"/PrintSetting/DefaultPrintSetting.xml", FileMode.Open, FileAccess.Read);
                PrintSetting defaultReportSetting = serializer.Deserialize(stream) as PrintSetting;

                fillControls(defaultReportSetting);
                this.lblWarning.Visible = false;
            }
            catch
            {
                this.lblWarning.Visible = true;
                this.cmbPrinter.Text    = printerHelper.getDeaultPrinterName();
                this.cmbPrinter_SelectedIndexChanged(this.cmbPrinter, null);
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
            }
        }