当前位置: 首页>>代码示例>>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;未经允许,请勿转载。