本文整理匯總了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();
}