本文整理汇总了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");
}
示例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();
}