本文整理汇总了C#中System.Drawing.Printing.Margins类的典型用法代码示例。如果您正苦于以下问题:C# Margins类的具体用法?C# Margins怎么用?C# Margins使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Margins类属于System.Drawing.Printing命名空间,在下文中一共展示了Margins类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DropShadow
/// <summary>
/// The actual method that makes API calls to drop the shadow to the window
/// </summary>
/// <param name="window">Window to which the shadow will be applied</param>
/// <returns>True if the method succeeded, false if not</returns>
private static bool DropShadow(Window window)
{
try
{
WindowInteropHelper helper = new WindowInteropHelper(window);
int val = 2;
int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4);
if (ret1 == 0)
{
Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 };
int ret2 = DwmExtendFrameIntoClientArea(helper.Handle, ref m);
return ret2 == 0;
}
else
{
return false;
}
}
catch (Exception)
{
// Probably dwmapi.dll not found (incompatible OS)
return false;
}
}
示例2: GetPrinters_Click
private void GetPrinters_Click(object sender, EventArgs e)
{
//PrintDocument pd = new PrintDocument();
//pd.DefaultPageSettings.Bounds = new
//pd.Print();
PrintPreviewDialog ppd = new PrintPreviewDialog();
PrintDocument pd = new PrintDocument();
//设置边距
Margins margin = new Margins(200, 20, 20, 0);
pd.DefaultPageSettings.Margins = margin;
//纸张设置默认
PaperSize pageSize = new PaperSize("First custom size", getYc(58), 100);
pd.DefaultPageSettings.PaperSize = pageSize;
//打印事件设置
pd.PrintPage += pd_PrintPage;
ppd.Document = pd;
ppd.ShowDialog();
//try
//{
// pd.Print();
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.Message, "打印出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
// pd.PrintController.OnEndPrint(pd, new PrintEventArgs());
//}
}
示例3: Print
public void Print()
{
//打印
if (string.IsNullOrEmpty(_print_doc.PrinterSettings.PrinterName))
{
_print_doc.PrinterSettings.PrinterName = new System.Drawing.Printing.PrintDocument().PrinterSettings.PrinterName;
}
//_print_doc.PrinterSettings.PrinterName = "Zebra 105SL"; // "Microsoft XPS Document Writer"; //
System.Drawing.Printing.Margins margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
_print_doc.DefaultPageSettings.Margins = margins;
// 设置纸张
PaperSize paperSize = new PaperSize();
switch (_lable.Type)
{
case LableType.BIG:
case LableType.BIG1:
case LableType.PIPE:
case LableType.PIPE2:
paperSize.Height = 394;
paperSize.Width = 285;
paperSize.PaperName = "大标牌";
_print_doc.DefaultPageSettings.PaperSize = paperSize;
break;
case LableType.LITTLE:
paperSize.Height = 217;
paperSize.Width = 264;
paperSize.PaperName = "小标牌";
_print_doc.DefaultPageSettings.PaperSize = paperSize;
break;
default:
break;
}
_print_doc.DefaultPageSettings.PrinterSettings.Copies = (short)_copies;
_print_doc.Print();
}
示例4: Chart
public Chart(ChartPanel chartPanel, string name)
{
_chartPanel = chartPanel;
_title = name;
_axisList = new List<Axis>();
_axisList.Add(new Axis(this, "Theta", "Degrees"));
_axisList.Add(new Axis(this, "R", "%"));
_margins = new Margins(52, 24, 24, 44);
_pnFrame = new Pen(Color.Silver, 1.0f);
_pnGridMain = new Pen(Color.Gray, 1.0f);
_pnGridAux = new Pen(Color.Gray, 1.0f);
_pnGridAux.DashStyle = DashStyle.Dash;
_pnSelection = new Pen(Color.FromKnownColor(KnownColor.HotTrack), 1.0f);
_pnProgress = new Pen(Color.SpringGreen, 2.0f);
_brSelection = new SolidBrush(Color.FromArgb(32, Color.FromKnownColor(KnownColor.HotTrack)));
_fntTickMarks = new Font("Arial", 8.0f);
_fntLabelsH = new Font("Arial", 8.0f, FontStyle.Bold);
_fntLabelsV = new Font("Arial", 8.0f, FontStyle.Bold/*, GraphicsUnit.Pixel, Encoding. 0, true*/);
_seriesList = new List<Series>();
CreateGradientBrushes();
}
示例5: DropShadow
private static bool DropShadow(Window window)
{
try
{
var helper = new WindowInteropHelper(window);
var attrValue = 2;
var attribute = DwmSetWindowAttribute(helper.Handle, 2, ref attrValue, 4);
if (attribute != 0)
{
return false;
}
var margins = new Margins
{
Bottom = 0,
Left = 0,
Right = 0,
Top = 0
};
return DwmExtendFrameIntoClientArea(helper.Handle, ref margins) == 0;
}
catch
{
return false;
}
}
示例6: MARGINS
public MARGINS(Margins margins)
{
cxLeftWidth = margins.Left;
cxRightWidth = margins.Right;
cyTopHeight = margins.Top;
cyBottomHeight = margins.Bottom;
}
示例7: InvoicePrint
/// <summary>
/// 数据打印
/// </summary>
/// <param name="printData"></param>
public virtual void InvoicePrint(PrintDataClass printData)
{
PrintDocument document = new PrintDocument();
//this.PrintData = printData;
Margins margins = new Margins(this.DanToPex(0.5M), this.DanToPex(0.5M), this.DanToPex(0.5M),
this.DanToPex(0.5M));
document.DefaultPageSettings.Margins = margins;
PaperSize size = new PaperSize("First custom size", this.DanToPex(PageSizeW), this.DanToPex(PageSizeH));
document.DefaultPageSettings.PaperSize = size;
document.PrintController = new StandardPrintController();
document.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
try
{
document.Print();
LogHelper.WriteLog("过磅编号为:" + GetTextDate() + "。数据打印成功!");
}
catch (Exception e)
{
document.PrintController.OnEndPrint(document, new PrintEventArgs());
LogHelper.WriteLog(LogHelper.GetCurSourceFileName() + "~" + LogHelper.GetLineNum() + "打印失败!", e);
}
finally
{
this.printData = null;
}
}
示例8: PageDef
public PageDef(Margins m, int count)
{
colstoprint = new List<object>(count);
colwidths = new List<float>(count);
colwidthsoverride = new List<float>(count);
coltotalwidth = 0;
margins = (Margins)m.Clone();
}
示例9: Report
public Report()
{
Width = 595F;
Height = 842F;
Margins = new Margins(0, 0, 50, 50);
Header = new ReportSection(this);
Body = new ReportSection(this);
Footer = new ReportSection(this);
}
示例10: GenerateReport
protected FixedDocument GenerateReport(Func<int, object> frameDataContext, Size paperSize, Margins margins, IEnumerable records)
{
var document = new FixedDocument();
document.DocumentPaginator.PageSize = new Size(DPI * paperSize.Width, DPI * paperSize.Height);
foreach (var page in CreatePages(frameDataContext, paperSize, margins, records))
{
document.Pages.Add(page);
}
return document;
}
示例11: ClientQuery
public ClientQuery()
{
_column = new QueryColumnsCollection(this, typeof(QueryColumns));
_caption = "";
_margin = new Margins(100, 30, 30, 30);
_gaphorizontal = 80;
_gapvertical = 20;
_keepcondition = false;
_font = new Font("SimSun", 9.0f);
_forecolor = SystemColors.ControlText;
_textcolor = SystemColors.ControlText;
}
示例12: frmPrint
public frmPrint()
{
InitializeComponent();
lines = new string[50];
printDialog.Document = docToPrint;
docToPrint.BeginPrint += new PrintEventHandler(OnBeginPrint);
docToPrint.PrintPage += new PrintPageEventHandler(OnPrintPage);
pageSetupDialog.Document = docToPrint;
previewDialog.Document = docToPrint;
Margins mar = new Margins(50, 50, 50, 50);
docToPrint.DefaultPageSettings.Margins = mar;
}
示例13: PageSettings
public PageSettings(PrinterSettings printerSettings)
{
if(printerSettings != null)
{
this.printerSettings = printerSettings;
}
else
{
this.printerSettings = new PrinterSettings();
}
margins = new Margins();
}
示例14: PrintPreviewLayout
internal PrintPreviewLayout(IServiceProvider serviceProvider, WorkflowPrintDocument printDoc) : base(serviceProvider)
{
this.pageLayoutInfo = new ArrayList();
this.headerFooterMargins = new Margins(0, 0, 0, 0);
this.pageSeparator = DefaultPageSeparator;
this.pageMargins = DefaultPageMargins;
this.rowColumns = new Size(1, 1);
this.scaling = 1f;
this.pageSize = Size.Empty;
this.previewTime = DateTime.Now;
this.printDocument = printDoc;
}
示例15: CtorDefault
public void CtorDefault ()
{
Margins m = new Margins ();
Assert.AreEqual (100, m.Left, "Left");
Assert.AreEqual (100, m.Top, "Top");
Assert.AreEqual (100, m.Right, "Right");
Assert.AreEqual (100, m.Bottom, "Bottom");
Assert.AreEqual ("[Margins Left=100 Right=100 Top=100 Bottom=100]", m.ToString (), "ToString");
Margins clone = (Margins) m.Clone ();
Assert.AreEqual (m, clone, "clone");
Assert.IsTrue (m == clone, "==");
Assert.IsFalse (m != clone, "!=");
}