예제 #1
0
 // used by PrinterSettings.DefaultPageSettings
 internal PageSettings(PrinterSettings printerSettings, bool color, bool landscape, PaperSize paperSize, PaperSource paperSource, PrinterResolution printerResolution)
 {
     PrinterSettings        = printerSettings;
     this.color             = color;
     this.landscape         = landscape;
     this.paperSize         = paperSize;
     this.paperSource       = paperSource;
     this.printerResolution = printerResolution;
 }
예제 #2
0
        public PageSettings(PrinterSettings printerSettings)
        {
            PrinterSettings = printerSettings;

            this.color             = printerSettings.DefaultPageSettings.color;
            this.landscape         = printerSettings.DefaultPageSettings.landscape;
            this.paperSize         = printerSettings.DefaultPageSettings.paperSize;
            this.paperSource       = printerSettings.DefaultPageSettings.paperSource;
            this.printerResolution = printerSettings.DefaultPageSettings.printerResolution;
        }
예제 #3
0
        public object Clone()
        {
            // We do a deep copy
            PrinterResolution pres    = new PrinterResolution(this.printerResolution.X, this.printerResolution.Y, this.printerResolution.Kind);
            PaperSource       psource = new PaperSource(this.paperSource.SourceName, this.paperSource.Kind);
            PaperSize         psize   = new PaperSize(this.paperSize.PaperName, this.paperSize.Width, this.paperSize.Height);

            psize.SetKind(this.paperSize.Kind);

            PageSettings ps = new PageSettings(this.printerSettings, this.color, this.landscape,
                                               psize, psource, pres);

            ps.Margins = (Margins)this.margins.Clone();
            return(ps);
        }
        /// <summary>
        /// Loads a printer's paper sources (trays). Returns the default PaperSource, and fills a list of paper_sources for use in dialogues
        /// </summary>
        /// <param name="settings">PrinterSettings object to fill</param>
        /// <param name="def_source">Default paper source, from the global options of the printer</param>
        /// <param name="paper_sources">List of available paper sizes that gets filled</param>
        private PaperSource LoadPrinterPaperSources(PrinterSettings settings, string def_source,
                                                    NameValueCollection paper_sources)
        {
            PaperSourceKind kind;
            PaperSource     defsource = null;

            foreach (string source in paper_sources)
            {
                switch (source)
                {
                case "Auto":
                    kind = PaperSourceKind.AutomaticFeed;
                    break;

                case "Standard":
                    kind = PaperSourceKind.AutomaticFeed;
                    break;

                case "Tray":
                    kind = PaperSourceKind.AutomaticFeed;
                    break;

                case "Envelope":
                    kind = PaperSourceKind.Envelope;
                    break;

                case "Manual":
                    kind = PaperSourceKind.Manual;
                    break;

                default:
                    kind = PaperSourceKind.Custom;
                    break;
                }
                settings.paper_sources.Add(new PaperSource(paper_sources[source], kind, def_source == source));
                if (def_source == source)
                {
                    defsource = settings.paper_sources[settings.paper_sources.Count - 1];
                }
            }

            if (defsource == null && settings.paper_sources.Count > 0)
            {
                return(settings.paper_sources[0]);
            }
            return(defsource);
        }
예제 #5
0
 public int Add(PaperSource paperSource)
 {
     return(_PaperSources.Add(paperSource));
 }