當前位置: 首頁>>代碼示例>>C#>>正文


C# PageSettings.Clone方法代碼示例

本文整理匯總了C#中System.Drawing.Printing.PageSettings.Clone方法的典型用法代碼示例。如果您正苦於以下問題:C# PageSettings.Clone方法的具體用法?C# PageSettings.Clone怎麽用?C# PageSettings.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Printing.PageSettings的用法示例。


在下文中一共展示了PageSettings.Clone方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CloneTest

		public void CloneTest ()
		{
			// Check for installed printers, because we need
			// to have at least one to test
			if (PrinterSettings.InstalledPrinters.Count == 0)
				Assert.Ignore ("No printers found.");

			PageSettings ps = new PageSettings ();
			ps.Color = false;
			ps.Landscape = true;
			ps.Margins = new Margins (120, 130, 140, 150);
			ps.PaperSize = new PaperSize ("My Custom Size", 222, 333);
			PageSettings clone = (PageSettings) ps.Clone ();

			Assert.AreEqual (ps.Color, clone.Color, "#1");
			Assert.AreEqual (ps.Landscape, clone.Landscape, "#2");
			Assert.AreEqual (ps.Margins, clone.Margins, "#3");
			Assert.AreSame (ps.PrinterSettings, clone.PrinterSettings, "#4");

			// PaperSize
			Assert.AreEqual (ps.PaperSize.PaperName, clone.PaperSize.PaperName, "#5");
			Assert.AreEqual (ps.PaperSize.Width, clone.PaperSize.Width, "#6");
			Assert.AreEqual (ps.PaperSize.Height, clone.PaperSize.Height, "#7");
			Assert.AreEqual (ps.PaperSize.Kind, clone.PaperSize.Kind, "#8");

			// PrinterResolution
			Assert.AreEqual (ps.PrinterResolution.X, clone.PrinterResolution.X, "#9");
			Assert.AreEqual (ps.PrinterResolution.Y, clone.PrinterResolution.Y, "#10");
			Assert.AreEqual (ps.PrinterResolution.Kind, clone.PrinterResolution.Kind, "#11");

			// PaperSource
			Assert.AreEqual (ps.PaperSource.Kind, clone.PaperSource.Kind, "#12");
			Assert.AreEqual (ps.PaperSource.SourceName, clone.PaperSource.SourceName, "#13");
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:34,代碼來源:PageSettingsTest.cs

示例2: StoreSetting

        public void StoreSetting(string printerName, PageSettings settings)
        {
            Debug.Assert(!string.IsNullOrEmpty(printerName));
            _printerName = printerName;

            if (null == settings)
                _InitPageSettings(_printerName);
            else
                _pageSettings = (PageSettings)settings.Clone();
        }
開發者ID:erindm,項目名稱:route-planner-csharp,代碼行數:10,代碼來源:PrinterSettings.cs


注:本文中的System.Drawing.Printing.PageSettings.Clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。