Exemplo n.º 1
0
 /// <summary>
 /// 加载默认值
 /// </summary>
 private void LoadDisplay()
 {
     Task.Run(() => {
         this.wifiTxt.Text  = FormConfigUtil.WifiPath;
         this.localTxt.Text = FormConfigUtil.LocationPath;
         this.logTxt.Text   = FormConfigUtil.LogPath;
         this.ipTxt.Text    = FormConfigUtil.IpPath;
         this.countTxt.Text = FormConfigUtil.PrintCount.ToString();
         var list           = new List <object> {
             new { key = "默认居中", value = "默认居中" }
         };
         this.localComboBox.DataSource    = list;
         this.localComboBox.ValueMember   = "value";
         this.localComboBox.DisplayMember = "key";
         this.localComboBox.SelectedValue = FormConfigUtil.ImgLocation;
         this.pageSize     = ImageSizeUtil.ConverntPaperSizeName(FormConfigUtil.PageSize);
         this.landscape    = FormConfigUtil.Landscape;
         this.marginLeft   = FormConfigUtil.MarginLeft;
         this.marginRight  = FormConfigUtil.MarginRight;
         this.marginTop    = FormConfigUtil.MarginTop;
         this.marginBottom = FormConfigUtil.MarginBottom;
         this.printDocument.DefaultPageSettings.PaperSize      = FormConfigUtil.GetPaperSize(printDocument, pageSize);
         this.printDocument.DefaultPageSettings.Margins.Top    = this.marginTop;
         this.printDocument.DefaultPageSettings.Margins.Left   = this.marginLeft;
         this.printDocument.DefaultPageSettings.Margins.Right  = this.marginRight;
         this.printDocument.DefaultPageSettings.Margins.Bottom = this.marginBottom;
         this.portTxt.Text = FormConfigUtil.Host;
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// 设置打印机
 /// </summary>
 private void SetPrint()
 {
     //设置打印份数
     printDocument.PrinterSettings.Copies = short.Parse(this.countTxt.Text);
     //启用页边距
     printDocument.OriginAtMargins = false;
     //横向纵向设置
     printDocument.DefaultPageSettings.Landscape = FormConfigUtil.Landscape;
     //尺寸设置
     printDocument.DefaultPageSettings.PaperSize = FormConfigUtil.GetPaperSize(printDocument, this.PagerSize);
     //打印机名称
     printDocument.PrinterSettings.PrinterName = this.PrintName;
 }