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


C# Printing.Margins類代碼示例

本文整理匯總了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;
            }
        }
開發者ID:dylandee,項目名稱:Wox,代碼行數:30,代碼來源:DWMDropShadow.cs

示例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());
            //}
        }
開發者ID:ysjr-2002,項目名稱:DeviceTest,代碼行數:28,代碼來源:FrmDefaultPrint.cs

示例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();
 }
開發者ID:Strongc,項目名稱:sencond,代碼行數:35,代碼來源:CorePrinter.cs

示例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();
        }
開發者ID:sinc,項目名稱:DeviceHandler,代碼行數:28,代碼來源:Chart.cs

示例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;
            }
        }
開發者ID:arthurzaczek,項目名稱:Slight.PenLighter,代碼行數:28,代碼來源:DwmHelper.cs

示例6: MARGINS

 public MARGINS(Margins margins)
 {
     cxLeftWidth = margins.Left;
     cxRightWidth = margins.Right;
     cyTopHeight = margins.Top;
     cyBottomHeight = margins.Bottom;
 }
開發者ID:AdamWarnock,項目名稱:Speed-Test-Loggger,代碼行數:7,代碼來源:Global.cs

示例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;
     }
 }
開發者ID:SaintLoong,項目名稱:GuiZhou_XiShui_AutoPrint,代碼行數:30,代碼來源:Form1.cs

示例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();
 }
開發者ID:softballsolutions,項目名稱:softballsolutions.Forms,代碼行數:8,代碼來源:sbDataGridPrinter.cs

示例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);
        }
開發者ID:koraytaylan,項目名稱:ReportSharp,代碼行數:10,代碼來源:Report.cs

示例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;
 }
開發者ID:frederiksen,項目名稱:Task-Card-Creator,代碼行數:10,代碼來源:ReportFromTemplate.cs

示例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;
 }
開發者ID:san90279,項目名稱:UK_OAS,代碼行數:12,代碼來源:ClientQuery.cs

示例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;
 }
開發者ID:jetpacktuxedo,項目名稱:library,代碼行數:12,代碼來源:frmPrint.cs

示例13: PageSettings

	public PageSettings(PrinterSettings printerSettings)
			{
				if(printerSettings != null)
				{
					this.printerSettings = printerSettings;
				}
				else
				{
					this.printerSettings = new PrinterSettings();
				}
				margins = new Margins();
			}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:12,代碼來源:PageSettings.cs

示例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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:12,代碼來源:PrintPreviewLayout.cs

示例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, "!=");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:13,代碼來源:MarginsTest.cs


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