當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。