当前位置: 首页>>代码示例>>C#>>正文


C# Printing.PrinterSettings类代码示例

本文整理汇总了C#中System.Drawing.Printing.PrinterSettings的典型用法代码示例。如果您正苦于以下问题:C# PrinterSettings类的具体用法?C# PrinterSettings怎么用?C# PrinterSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PrinterSettings类属于System.Drawing.Printing命名空间,在下文中一共展示了PrinterSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StrukPrint

 public StrukPrint()
 {
     printDocObatBebas.PrintPage += new PrintPageEventHandler(printDoc_obatBebas_PrintPage);
     printDocResepDokter.PrintPage += new PrintPageEventHandler(printDoc_resepDokter_PrintPage);
     printDocGantiOperator.PrintPage += new PrintPageEventHandler(printDoc_gantiOperator_PrintPage);
     System.OperatingSystem osInfo = System.Environment.OSVersion;
     //MessageBox.Show(osInfo.Version.ToString());
     PrinterSettings setttt = new PrinterSettings();
     foreach(string printer in PrinterSettings.InstalledPrinters)
     {
         setttt.PrinterName = printer;
         if (setttt.IsDefaultPrinter)
         {
             if (printer.ToLower().Contains("220"))
             {
                 this.fontSize = 8.55F;
                 this.paperWidth = 32;
                 this.strips = "================================\n";
                 this.singleStrips = "--------------------------------\n";
                 this.marginLeftSubs = 90;
             }
             else
             {
                 this.fontSize = 8.5F;
                 this.paperWidth = 34;
                 this.strips = "==================================\n";
                 this.singleStrips = "----------------------------------\n";
                 this.marginLeftSubs = 85;
             }
         }
     }
 }
开发者ID:aldowrable,项目名称:accountingsolution,代码行数:32,代码来源:StrukPrint.cs

示例2: print

        public void print()
        {
            PrintDialog pd = new PrintDialog();
            pdoc = new PrintDocument();
            PrinterSettings ps = new PrinterSettings();
            Font font = new Font("Courier New", 15);

            PaperSize psize = new PaperSize("Custom", 300, 100);
            ps.DefaultPageSettings.PaperSize = psize;

            pd.Document = pdoc;
            pd.Document.DefaultPageSettings.PaperSize = psize;

            pdoc.DefaultPageSettings.PaperSize = psize;

            pdoc.PrintPage += new PrintPageEventHandler(pdoc_PrintPage);

            DialogResult result = pd.ShowDialog();
            if (result == DialogResult.OK)
            {
                PrintPreviewDialog pp = new PrintPreviewDialog();
                pp.Document = pdoc;

                result = pp.ShowDialog();
                if (result == DialogResult.OK)
                {
                    pdoc.Print();
                }
            }
        }
开发者ID:hydrohead,项目名称:MWSZonBarcode,代码行数:30,代码来源:Printing.cs

示例3: print

        public void print()
        {
            PrintDialog pd = new PrintDialog();
            PrintDocument pdoc = new PrintDocument();
            PrinterSettings ps = new PrinterSettings();
            Font font =new Font("Arial",12);
            PaperSize psize = new PaperSize("Custome", 100, 200);
            pd.Document = pdoc;
            pd.Document.DefaultPageSettings.PaperSize = psize;
            pdoc.DefaultPageSettings.PaperSize.Height = 320;
            pdoc.DefaultPageSettings.PaperSize.Width = 200;
            pdoc.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
            DialogResult result = pd.ShowDialog();
            if (result == DialogResult.OK)
            {
                PrintPreviewDialog ppd = new PrintPreviewDialog();
                ppd.Document = pdoc;
                result = ppd.ShowDialog();
                if (result == DialogResult.OK)
                {
                    pdoc.Print();

                }
            }



        }
开发者ID:neyosuraj,项目名称:thisistestRepository,代码行数:28,代码来源:orderlist.cs

示例4: printForm_Load

        private void printForm_Load(object sender, EventArgs e)
        {
            //
            try
            {

                PrinterSettings settings = new PrinterSettings();
                string strDefaultPrint = settings.PrinterName;
                foreach (String printer in PrinterSettings.InstalledPrinters)
                {
                    printersList.Items.Add(printer.ToString());
                    if (printer.ToString().Equals(strDefaultPrint))
                    {
                        printersList.SelectedIndex = (printersList.Items.Count - 1);
                    }
                }
                cmbStyle.SelectedIndex = 0;
                this.Focus();

            }
            catch (Exception ex)
            {
                MessageBox.Show("An error accoured while loading the printers! \nPlease try again or restart the program", "Error", MessageBoxButtons.OK);
            }
                
        }
开发者ID:Meekgal,项目名称:ScreenCaptureSoftware,代码行数:26,代码来源:printForm.cs

示例5: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            PrintDialog pd = new PrintDialog();
            PrinterSettings ps = new PrinterSettings();
            pd.PrinterSettings = ps;
            DialogResult dr = pd.ShowDialog();

            if (dr == DialogResult.OK) {
                QRPrint printer = new QRPrint();
                printer.PrintMode = QRPrint.PrintModes.PsyBanknote;
                printer.NotesPerPage = (int)numVouchersPerPage.Value;
                switch (cboArtworkStyle.Text.ToLower()) {
                    case "yellow":
                    case "green":
                    case "blue":
                    case "purple":
                    case "greyscale":
                        printer.ImageFilename = "note-" + cboArtworkStyle.SelectedItem.ToString().ToLowerInvariant() + ".png";
                        break;
                }
                printer.Denomination = txtDenomination.Text;
                printer.keys = new List<KeyCollectionItem>(Items.Count);
                printer.PreferUnencryptedPrivateKeys = chkPrintUnencrypted.Checked;
                foreach (KeyCollectionItem a in Items) printer.keys.Add(a);
                printer.PrinterSettings = pd.PrinterSettings;
                printer.Print();
                PrintAttempted = true;
            }
        }
开发者ID:salfter,项目名称:Bitcoin-Address-Utility,代码行数:29,代码来源:PrintVouchers.cs

示例6: GetPrinterInfo

        public static bool GetPrinterInfo(ref PrinterInfo printerInfo)
        {
            printerInfo.Status = Status.None;

            string query = string.Format("SELECT * from Win32_Printer WHERE Name LIKE '%{0}'", printerInfo.Caption);
            var searcher = new ManagementObjectSearcher(query);
            var coll = searcher.Get();

            foreach (ManagementObject printer in coll)
            {
                var ps = new PrinterSettings {PrinterName = printerInfo.Caption};
                if (ps.IsValid)
                {
                    printerInfo.Status = Status.OK;
                    printerInfo.Port = printer.Properties["PortName"].Value.ToString();
                    printerInfo.Driver = printer.Properties["DeviceID"].Value.ToString();
                    printerInfo.Color = ps.SupportsColor;
                    printerInfo.Name = printer.Properties["DeviceID"].Value.ToString();
                    printerInfo.Network = Convert.ToBoolean(printer.Properties["Network"].Value);
                }
                else
                {
                    printerInfo.Status = Status.Error;
                }
            }
            return true;
        }
开发者ID:SameerOmar,项目名称:InkMon,代码行数:27,代码来源:PrinterHelper.cs

示例7: LoadDefaultResolutions

		internal void LoadDefaultResolutions (PrinterSettings.PrinterResolutionCollection col)
		{
			col.Add (new PrinterResolution ((int) PrinterResolutionKind.High, -1, PrinterResolutionKind.High));
			col.Add (new PrinterResolution ((int) PrinterResolutionKind.Medium, -1, PrinterResolutionKind.Medium));
			col.Add (new PrinterResolution ((int) PrinterResolutionKind.Low, -1, PrinterResolutionKind.Low));
			col.Add (new PrinterResolution ((int) PrinterResolutionKind.Draft, -1, PrinterResolutionKind.Draft));
		}
开发者ID:sushihangover,项目名称:playscript,代码行数:7,代码来源:PrintingServices.cs

示例8: btnPrint_Click

        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                PrinterSettings printSet = new PrinterSettings();//打印机设置

                if (this.pageSet != null)
                {
                    printDocument.DefaultPageSettings = this.pageSet;
                }

                printD.PrinterSettings = printSet;

                printD.Document = printDocument;
                printDocument.DocumentName = "NavicertCard";

                if (printD.ShowDialog() == DialogResult.OK)
                {
                    printDocument.Print();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:SaintLoong,项目名称:HanCheng_SendCard,代码行数:27,代码来源:NavicertCardPrint.cs

示例9: btStampa_Click

        private void btStampa_Click(object sender, EventArgs e)
        {
            // SE IL RADIOBUTTON E' SU LOCAL USA QUELLA STAMPANTE SELEZIONATA
            if (rdStampantiLocali.Checked)
                nomeStampante = cbStampantiLocali.SelectedItem.ToString();
            // ALTRIMENTI USA QUELLA DI RETE
            else
                nomeStampante = cbStampantiRete.SelectedItem.ToString();

            PrinterSettings printerSettings = new PrinterSettings();
            printerSettings.PrinterName = nomeStampante;

            // SE E' VALIDA -> STAMPA
            if (printerSettings.IsValid)
            {
                printDoc.PrinterSettings = printerSettings;

                // PROVIAMO A STAMPARE
                try
                {
                    printDoc.Print();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
开发者ID:archistico,项目名称:InviaStampante,代码行数:28,代码来源:frmStampa.cs

示例10: PageSetupForm

        ///<summary>
        /// Creates a new instance of the Page Setup Form
        ///</summary>
        ///<param name="settings"></param>
        public PageSetupForm(PrinterSettings settings)
        {
            //This call is required by the Windows Form Designer.
            InitializeComponent();

            //Store the printer settings
            _printerSettings = settings;

            //Gets the list of available paper sizes
            ComboPaperSizes.SuspendLayout();
            PrinterSettings.PaperSizeCollection paperSizes = _printerSettings.PaperSizes;
            foreach (PaperSize ps in paperSizes)
                ComboPaperSizes.Items.Add(ps.PaperName);
            ComboPaperSizes.SelectedItem = settings.DefaultPageSettings.PaperSize.PaperName;
            if (ComboPaperSizes.SelectedIndex == -1) ComboPaperSizes.SelectedIndex = 1;
            ComboPaperSizes.ResumeLayout();

            //Gets the paper orientation
            if (_printerSettings.DefaultPageSettings.Landscape)
                _rdbLandscape.Checked = true;
            else
                _rdbPortrait.Checked = true;

            //Gets the margins
            _left = settings.DefaultPageSettings.Margins.Left / 100.0;
            txtBoxLeft.Text = String.Format("{0:0.00}", _left);
            _top = settings.DefaultPageSettings.Margins.Top / 100.0;
            txtBoxTop.Text = String.Format("{0:0.00}", _top);
            _bottom = settings.DefaultPageSettings.Margins.Bottom / 100.0;
            txtBoxBottom.Text = String.Format("{0:0.00}", _bottom);
            _right = settings.DefaultPageSettings.Margins.Right / 100.0;
            txtBoxRight.Text = String.Format("{0:0.00}", _right);
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:37,代码来源:PageSetupForm.cs

示例11: btnPrint_Click

        private void btnPrint_Click(object sender, EventArgs e)
        {
            PrintDialog pd = new PrintDialog();
            pdoc = new PrintDocument();
            PrinterSettings ps = new PrinterSettings();
            Font font = new Font("Courier New", 15);

            PaperSize psize = new PaperSize("Custom", 100, 200);

            pd.Document = pdoc;
            pd.Document.DefaultPageSettings.PaperSize = psize;
            pdoc.DefaultPageSettings.PaperSize.Height = 720;

            pdoc.DefaultPageSettings.PaperSize.Width = 620;

            pdoc.PrintPage += new PrintPageEventHandler(pdoc_PrintPage);

            DialogResult result = pd.ShowDialog();
            if (result == DialogResult.OK)
            {
                PrintPreviewDialog pp = new PrintPreviewDialog();
                pp.Document = pdoc;
                result = pp.ShowDialog();
                if (result == DialogResult.OK)
                {
                    pdoc.Print();
                }
            }
        }
开发者ID:thanhhnk,项目名称:ProP_LoopIT,代码行数:29,代码来源:FoodShop.cs

示例12: print

        public void print()
        {
            PrintDialog pd = new PrintDialog();
            pdoc = new PrintDocument();
            PrinterSettings ps = new PrinterSettings();
            Font font = new Font("Courier New", 15);

             //PaperSize psize = new PaperSize("Custom", 219, 1000);
            pd.Document = pdoc;
            //pd.Document.DefaultPageSettings.PaperSize = psize;

            if (pd.Document.DefaultPageSettings.PaperSize.Width <= 284)
            {
                k = Convert.ToDouble(pd.Document.DefaultPageSettings.PaperSize.Width) / 284;
            }

            pdoc.PrintPage += new PrintPageEventHandler(pdoc_PrintPage);

            DialogResult result = pd.ShowDialog();
            if (result == DialogResult.OK)
            {
                PrintPreviewDialog pp = new PrintPreviewDialog();
                pp.Document = pdoc;
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
                pp.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
                pp.PrintPreviewControl.Zoom = 1f;
                result = pp.ShowDialog();
                if (result == DialogResult.OK)
                {
                    pdoc.Print();
                }
            }
        }
开发者ID:ochirpurev,项目名称:CSPosAPI,代码行数:33,代码来源:MainForm.cs

示例13: base

	protected InvalidPrinterException
				(SerializationInfo info, StreamingContext ctxt)
			: base(info, ctxt)
			{
				settings = (PrinterSettings)
					info.GetValue("settings", typeof(PrinterSettings));
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:InvalidPrinterException.cs

示例14: PrintEnrollmentAction

 public PrintEnrollmentAction(PrinterSettings settings, string idEnrollments, string course)
 {
     this.settings = settings;
     theSet = createDataSet(idEnrollments);
     division = Database.Row("division", "DivisionAbrev = '" + GlobalProperties.loggedOnUserDivison + "'");
     this.course = course;
 }
开发者ID:robertfall,项目名称:LAD,代码行数:7,代码来源:PrintEnrollmentAction.cs

示例15: Print2

    public static void Print2(string wordfile, string printer = null)
    {
        oWord.Application wordApp = new oWord.Application();
        wordApp.Visible = false;

        wordApp.Documents.Open(wordfile);
        wordApp.DisplayAlerts = oWord.WdAlertLevel.wdAlertsNone;

        System.Drawing.Printing.PrinterSettings settings = new System.Drawing.Printing.PrinterSettings();

        if (printer == null) // print to all installed printers
        {
            foreach (string p in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
            {
                try
                {
                    settings.PrinterName = p;
                    wordApp.ActiveDocument.PrintOut(false);
                }
                catch (Exception ex)
                {
                    Logger.LogException(ex, true);
                }
            }
        }
        else
        {
            settings.PrinterName = printer;
            wordApp.ActiveDocument.PrintOut(false);
        }

        wordApp.Quit(oWord.WdSaveOptions.wdDoNotSaveChanges);
    }
开发者ID:nblaurenciana-md,项目名称:Websites,代码行数:33,代码来源:WordDocServerSidePrinter.cs


注:本文中的System.Drawing.Printing.PrinterSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。