private void buttonCopyObjects_Click(object sender, EventArgs e) { if (copyDialog.ShowDialog(Main.main) == DialogResult.Cancel) { return; } int numberOfCopies = (int)copyDialog.numericCopies.Value; List <PrintModel> newSTL = new List <PrintModel>(); foreach (PrintModel act in ListObjects(true)) { PrintModel last = act; for (int i = 0; i < numberOfCopies; i++) { PrintModel stl = last.copyPrintModel(); last = stl; newSTL.Add(stl); } } foreach (PrintModel stl in newSTL) { AddObject(stl); cont.models.AddLast(stl); } if (copyDialog.checkAutoposition.Checked) { Autoposition(); } Main.main.threedview.UpdateChanges(); }
public CorneringModel(PrinterModel PrinterModel, PrintModel PrintModel, ParametersModel ParametersModel) { _printerModel = PrinterModel; _printModel = PrintModel; _parametersModel = ParametersModel; }
public bool Update(PrintModel model) { StringBuilder builder = new StringBuilder(); builder.Append(@" UPDATE SYS_PRINT SET ButtonName = @ButtonName ,Orders = @Orders ,StyleName = @StyleName ,IsDisplay = @IsDisplay ,IsPrint = @IsPrint ,Col2 = @Col2 ,Col3 = @Col3 WHERE ID = @ID "); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@ButtonName", model.ButtonName), new MySqlParameter("@Orders", model.Orders), new MySqlParameter("@StyleName", model.StyleName), new MySqlParameter("@IsDisplay", model.IsDisplay), new MySqlParameter("@IsPrint", model.IsPrint), new MySqlParameter("@Col2", model.Col2), new MySqlParameter("@Col3", model.Col3), new MySqlParameter("@ID", model.ID) }; return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0); }
private void PrintWithThread(object objectPara) { try { this.totalDocument++; HttpRequest httpRequest = objectPara as HttpRequest; if (httpRequest != null) { PrintModel model = ModelMaper.GetPrintModel(httpRequest.Body); if (model.print_interval <= 0) { //不要求顺序打印 DoPrintJobWithModel(model); } else { DoPrintJonWithModelSerial(model); } } else { SafeFireLoging("当前传递的参数不正确,当前传入的参数类型为:" + typeof(object).Name); } } catch (Exception ex) { SafeFireLoging("打印文件失败:" + ex.Message); HttpServer.Logger.Log(ex.ToString()); } SafeFirsStatistics(); }
private void listSTLObjects_SelectedIndexChanged(object sender, EventArgs e) { Main.main.threedview.updateCuts = true; updateEnabled(); LinkedList <PrintModel> list = ListObjects(false); LinkedList <PrintModel> sellist = ListObjects(true); PrintModel stl = (sellist.Count == 1 ? sellist.First.Value : null); foreach (PrintModel s in list) { s.Selected = sellist.Contains(s); } if (stl != null) { textRotX.Text = stl.Rotation.x.ToString(GCode.format); textRotY.Text = stl.Rotation.y.ToString(GCode.format); textRotZ.Text = stl.Rotation.z.ToString(GCode.format); LockAspectRatio = (stl.Scale.x == stl.Scale.y && stl.Scale.x == stl.Scale.z); textScaleX.Text = stl.Scale.x.ToString(GCode.format); textScaleY.Text = stl.Scale.y.ToString(GCode.format); textScaleZ.Text = stl.Scale.z.ToString(GCode.format); textTransX.Text = stl.Position.x.ToString(GCode.format); textTransY.Text = stl.Position.y.ToString(GCode.format); textTransZ.Text = stl.Position.z.ToString(GCode.format); } Main.main.threedview.UpdateChanges(); }
public async Task <PrintModel> GetPrintModel() { var result = new PrintModel(); var printConfig = this.Config.GetSection("PrintDefault").Get <PrintConfigModel>(); result.PrintName = printConfig.PrintName; result.Template = printConfig.Template; result.Action = printConfig.Action; result.IsWait = printConfig.IsWait; var httpContext = this.ContextAccessor.HttpContext; var query = httpContext.Request.Query; if (query.ContainsKey(nameof(result.PrintName))) { result.PrintName = query[nameof(result.PrintName)]; } if (query.ContainsKey(nameof(result.Copies))) { result.Copies = int.Parse(query[nameof(result.Copies)]); } if (query.ContainsKey(nameof(result.Template))) { result.Template = query[nameof(result.Template)]; } if (query.ContainsKey(nameof(result.Action))) { result.Action = (PrintActionType)Enum.Parse(typeof(PrintActionType), query[nameof(result.Action)]); } if (query.ContainsKey(nameof(result.IsWait))) { result.IsWait = new string[] { "True", "1", "Y", "ON", "true", "1", "y", "on" } }
private void UpdateListContainer(ListViewItem item, Character c) { item.Height = PrintModel.GlyphSize; Grid g = (Grid)item.ContentTemplateRoot; g.ColumnDefinitions[0].Width = new GridLength(PrintModel.GlyphSize); TextBlock t = (TextBlock)g.Children[0]; t.Height = t.Width = PrintModel.GlyphSize; TextBlock unicodeId = ((TextBlock)((StackPanel)g.Children[1]).Children[0]); unicodeId.SetVisible(PrintModel.Annotation != GlyphAnnotation.None); unicodeId.Text = c.GetAnnotation(PrintModel.Annotation); TextBlock description = ((TextBlock)((StackPanel)g.Children[1]).Children[1]); try { description.Text = PrintModel.Font.GetDescription(c); } catch { } IXamlDirectObject o = _xamlDirect.GetXamlDirectObject(t); CharacterGridView.SetGlyphProperties(_xamlDirect, o, PrintModel.GetTemplateSettings(), c); foreach (var r in g.GetFirstLevelDescendantsOfType <Rectangle>()) { r.SetVisible(PrintModel.ShowBorders); } }
private void toolSplitObject_Click(object sender, EventArgs e) { PrintModel act = SingleSelectedModel; if (act == null) { return; } List <TopoModel> models = act.ActiveModel.SplitIntoSurfaces(); if (models.Count == 1) { return; } int idx = 1; foreach (TopoModel m in models) { PrintModel pm = act.cloneWithModel(m, idx++); cont.models.AddLast(pm); AddObject(pm); } cont.models.Remove(act); RemoveObject(act); }
public void AddObject(PrintModel model) { ListViewItem item = new ListViewItem(model.name); item.Tag = model; Button button = new Button(); button.ImageList = imageList16; button.ImageIndex = 4; button.ImageAlign = ContentAlignment.MiddleCenter; button.Width = 16; button.Height = 16; button.TextImageRelation = TextImageRelation.Overlay; button.Text = ""; button.Tag = model; button.FlatStyle = FlatStyle.Flat; button.FlatAppearance.BorderSize = 0; button.Click += buttonRemoveObject_Click; button.Visible = false; delButtonList.Add(item, button); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); listObjects.Controls.Add(button); listObjects.Items.Add(item); SetObjectSelected(model, true); }
static public void Execute(PrintModel pm) { ObjectInformation info = new ObjectInformation(); info.Analyse(pm); info.Show(Main.main); }
public void AddModels(ModelFromFile fromFile, bool isNew)//(string fileName,byte[] data) { if (!availableModel) { availableGCode = false; gCode = ""; GCodeChange(gCode); InitSlicerView(); } availableModel = true; IsChanged = true; PrintModel model = new PrintModel(control, fromFile); model.Load(fromFile.Name, fromFile.Data); model.update(); if (isNew) { model.Center(SettingsProvider.Instance.Printer_Settings.PrintAreaWidth / 2, SettingsProvider.Instance.Printer_Settings.PrintAreaDepth / 2); model.Land(); } ModelList.Add(model); if (model.ActiveModel.triangles.Count > 0) { PreView.models.AddLast(model); if (isNew) { Allocate(model); model.addAnimation(new DropAnimation("drop")); } updateSTLState(model); } }
private bool PrintCommon(bool previewOnly = false, bool isRecoveredPrint = false) { const string XsdName = "InvoiceDataSet"; const string ReportName = "Print//SalesOrder.rdlc"; if (SaleList == null || SaleSelected == null) { MvvmUtility.ShowMessageAsync("请选择要打印预览的销售单"); return(false); } SaleSelected.IsRecoveredPrint = isRecoveredPrint; var printModel = new PrintModel { SaleDT = new List <SaleDto> { SaleSelected }, SaleDetailDT = InvoiceDetail4List, }; MvvmUtility.PerformActionOnUIThread( () => { IPrint print = new PrintWin(); print.Print(XsdName, ReportName, printModel, previewOnly); }); return(true); }
protected void Page_Load(object sender, EventArgs e) { JavaScriptSerializer jss = new JavaScriptSerializer(); string sBarcodeNum = this.Request["BarCodeNum"]; Msg msg = PrintModel.GetBarCodeNum(sBarcodeNum); BarCodeRet ret = new BarCodeRet(); if (msg.Status) { Tbl_BarCodeInfo info = msg.UserData as Tbl_BarCodeInfo; ret.Status = (int)MsgStatus.成功; ret.Message = ""; ret.BuildBunchId = int.Parse(info.BarCodeBatchID.ToString()); ret.BuildName = info.BuildName; ret.CreateTime = info.CreateTime.ToString(); ret.MetariesType = info.MateriesType; ret.ProjectName = info.ProjectName; ret.WorkMapId = info.WorkMapID; } else { ret.Status = (int)MsgStatus.失败; ret.Message = msg.Message; } this.Response.Write(jss.Serialize(ret)); }
public PrintModel FindOptimalPlacement() { var commertialPlacementsForProgram = new List <Placement[]>(); var commercialPermutationList = GetCommercialPermutations(); foreach (var Commercial in commercialPermutationList.ToList()) { commertialPlacementsForProgram.Add(_placement.BuildPlacements(Commercial.ToList())); } commertialPlacementsForProgram.RemoveAll(placements => placements.Any(p => p.Rate == 0)); commertialPlacementsForProgram.RemoveAll(placements => placements.Any(p => p.Commercional == null)); var optimalMaxRatePlacement = commertialPlacementsForProgram.ToList() .GroupBy(placements => placements.Sum(p => p.Rate)) .OrderByDescending(o => o.Key) .FirstOrDefault(); var printModel = new PrintModel(); foreach (var placements in optimalMaxRatePlacement) { printModel.Placements = placements; printModel.TotalRate = optimalMaxRatePlacement.Key; } ; return(printModel); }
public virtual ActionResult GetReportSnapshot(string fileName, string sourceName, string sourceData) { PrintModel model = new PrintModel(); model.fileName = fileName; model.sourceName = "Source"; model.sourceData = null; if (fileName == "packListB") { model.sourceData = BLLFactory <PackList_Head> .Instance.GetPrint(sourceData); model.sourceName = sourceName; model.fileName = fileName; } // 创建报表对象 Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport(); //读取文件 report.Load(Server.MapPath(string.Format("~/Content/reports/{0}.mrt", model.fileName))); //截止读取 report.Compile(); if (!string.IsNullOrEmpty(model.sourceName) && model.sourceData != null) { //注册数据源P report.RegData(model.sourceName, model.sourceData); } //返回报表 return(Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(report)); }
public static bool AddJob(FileHelper fileModel, string entityName, string primaryKey, int printerId, string userId) { string printDirectory = FileDirectoryService.GetPathByName("PrintServiceDirectory"); BaseModelContext <PrintModel> printDb = new BaseModelContext <PrintModel>(); PrintModel printModel = new PrintModel() { EntityName = entityName, PrimaryKey = primaryKey, PrinterId = printerId, FileLocation = "C:\\Temp", Status = PrintModel.newStatus }; printDb.Models.Add(printModel); printDb.SaveChanges(userId); if (printModel.Id > 0) { string printServicePath = printDirectory + printModel.Id.ToString() + "-" + fileModel.FileName; if (fileModel.CopyTo(printServicePath)) { printModel.Status = PrintModel.queuedStatus; printModel.FileLocation = printServicePath; printDb.Entry(printModel); printDb.SaveChanges(userId); return(true); } else { printDb.Models.Remove(printModel); printDb.SaveChanges(userId); } } return(false); }
public static void print(PrintModel print) { try { string directory = Directory.GetCurrentDirectory(); string pfad = directory + @"\ivy_label.LBX"; bpac.DocumentClass doc = new DocumentClass(); doc.Open(pfad); doc.GetObject("ArticleID").Text = print.ArticleID.ToString(); doc.GetObject("ArticleBCode").Text = print.ArticleID.ToString(); doc.GetObject("Manufacturer").Text = print.Manufacturer.ToString(); doc.GetObject("ManufacturerPartNumber").Text = print.ManufacturerPartNumber.ToString(); doc.GetObject("ArticleQR").Text = print.ArticleID.ToString(); doc.GetObject("Description").Text = print.Description.ToString(); doc.SetPrinter("Brother QL-500", true); doc.StartPrint("", PrintOptionConstants.bpoDefault); doc.PrintOut(1, PrintOptionConstants.bpoDefault); doc.EndPrint(); doc.Close(); }catch (Exception e) { MessageBox.Show(e.ToString()); } }
public void RemoveObject(PrintModel model) { ListViewItem item = null; foreach (ListViewItem test in listObjects.Items) { if (test.Tag == model) { item = test; break; } } if (item == null) { return; } Button trash = delButtonList[item]; if (trash != null) { listObjects.Controls.Remove(trash); delButtonList.Remove(item); } foreach (Button b in delButtonList.Values) { b.Visible = false; } listObjects.Items.Remove(item); if (objectModelRemovedEvent != null) { objectModelRemovedEvent(model); } }
private static List <PrintModel> SetValues(List <string> CommentLegalValues, PrintModel AnswerValue, List <PrintModel> QuestionAnswerList) { if (!string.IsNullOrEmpty(AnswerValue.Value)) { string NewValue = string.Empty; if (!AnswerValue.Value.Contains('-')) { try { NewValue = CommentLegalValues.Where(x => x.StartsWith(AnswerValue.Value + "-")).Single(); } catch { NewValue = CommentLegalValues.Where(x => x.StartsWith(AnswerValue.Value + " -")).Single(); } } else { NewValue = CommentLegalValues.Where(x => x.StartsWith(AnswerValue.Value)).Single(); } NewValue = NewValue.Split(new char[] { '-' }, 2)[1]; // Split(new char[] { '-' }, 2) QuestionAnswerList.Remove(AnswerValue); AnswerValue.Value = NewValue; } QuestionAnswerList.Add(AnswerValue); return(QuestionAnswerList); }
public void openAndAddObject(string file) { PrintModel model = new PrintModel(); FileInfo f = new FileInfo(file); InfoProgressPanel ipp = InfoProgressPanel.Create(Trans.T1("IMPORTING_1", f.Name), true); ipp.Action = Trans.T("L_LOADING..."); ipp.Dock = DockStyle.Top; panelControls.Controls.Add(ipp); panelControls.Update(); model.Load(file, ipp); model.Center(Main.printerSettings.PrintAreaWidth / 2, Main.printerSettings.PrintAreaDepth / 2); model.Land(); if (model.ActiveModel.triangles.Count > 0) { AddObject(model); cont.models.AddLast(model); Autoposition(); model.addAnimation(new DropAnimation("drop")); updateSTLState(model); } else { if (!ipp.IsKilled) { MessageBox.Show(Trans.T1("L_LOADING_3D_FAILED", file), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } ipp.Finished(); }
internal static List <PrintModel> SetCommentLegalValues(List <PrintModel> QuestionAnswerList, SurveyControlsResponse List, SurveyInfoModel surveyInfoModel, SourceTablesResponse SourceTables) { try { XDocument xdoc = XDocument.Parse(surveyInfoModel.XML); var Node = xdoc.Element("SourceTable"); if (Node == null) { xdoc = Epi.Web.Common.Xml.SurveyXml.AddSourceTableToXml(xdoc, SourceTables.List); } var CommentLegals = List.SurveyControlList.Where(x => x.ControlType == "CommentLegal"); if (CommentLegals.Count() > 0) { foreach (var item in CommentLegals) { List <string> CommentLegalValues = GetCommentLegalValues(xdoc, item.ControlId); PrintModel AnswerValue = QuestionAnswerList.Where(x => x.ControlName == item.ControlId).Single(); QuestionAnswerList = SetValues(CommentLegalValues, AnswerValue, QuestionAnswerList); } } } catch (Exception ex) { throw ex; } return(QuestionAnswerList); }
public IActionResult PrintPaper([FromBody] PrintModel model) { var printService = _factory.Create("paper"); printService.Print(model); return(Ok()); }
private void PintCertificate() { DataGridView dgv = new DataGridView(); dgv.Columns.Add("Name", "姓名"); dgv.Columns.Add("ToTime", "抵店日期"); dgv.Columns.Add("OutTime", "抵店时间"); dgv.Columns.Add("ConsumeName", "消费项目"); dgv.Columns.Add("UnitPrice", "单价"); dgv.Columns.Add("Unit", "单位"); dgv.Columns.Add("Number", "消费数量"); dgv.Columns.Add("TotalMoney", "应收"); //dgv.Columns["Name"].Width = dgvConsumeDetail.Columns["Name"].Width; dgv.Columns["ConsumeName"].Width = dgvConsumeDetail.Columns["ConsumeName"].Width; dgv.Columns["UnitPrice"].Width = dgvConsumeDetail.Columns["UnitPrice"].Width; dgv.Columns["Unit"].Width = dgvConsumeDetail.Columns["Unit"].Width; dgv.Columns["Number"].Width = dgvConsumeDetail.Columns["Number"].Width; dgv.Columns["TotalMoney"].Width = dgvConsumeDetail.Columns["TotalMoney"].Width; dgv.Width = dgv.Columns["ConsumeName"].Width + dgv.Columns["UnitPrice"].Width + dgv.Columns["Unit"].Width + dgv.Columns["Number"].Width + dgv.Columns["TotalMoney"].Width; dgv.AllowUserToAddRows = true; int i = 0; foreach (DataGridViewRow dgvr in dgvConsumeDetail.Rows) { dgv.Rows.Add(); dgv.Rows[i].Cells["ConsumeName"].Value = dgvr.Cells["ConsumeName"].Value; dgv.Rows[i].Cells["UnitPrice"].Value = dgvr.Cells["UnitPrice"].Value; dgv.Rows[i].Cells["Unit"].Value = dgvr.Cells["Unit"].Value; dgv.Rows[i].Cells["Number"].Value = dgvr.Cells["Number"].Value; dgv.Rows[i].Cells["TotalMoney"].Value = dgvr.Cells["TotalMoney"].Value; i++; } dgv.Rows.Add(); dgv.Rows[i].Cells["ConsumeName"].Value = "合计:"; dgv.Rows[i].Cells["UnitPrice"].Value = txtTotal.Text; dgv.Rows[i].Cells["Unit"].Value = "押金:"; dgv.Rows[i].Cells["Number"].Value = lblDeposit.Text; dgv.Rows[i].Cells["TotalMoney"].Value = "找零:" + (double.Parse(lblDeposit.Text) - double.Parse(txtTotal.Text)).ToString(); if (dgvConsumeDetail.Rows.Count > 0) { PrintInfo bPrint = new PrintInfo(); PrintModel mPrint = new PrintModel(); mPrint = bPrint.GetPrintModel(new PrintModel(this.Name), new ObjectControls(MCtrl.ByPrintNo)); CommonModel mComm = new CommonModel(); mPrint = bPrint.GetPrintSet(mPrint, new Object[] { UserInfo }); DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv }); dgvp.GetPrintConfig = mPrint; dgvp.Print(true, false); } }
private void PintCertificate() { DataGridView dgv = new DataGridView(); dgv.Columns.Add("ConsumeName", "消费项目"); dgv.Columns.Add("UnitPrice", "单价"); dgv.Columns.Add("Unit", "单位"); dgv.Columns.Add("Number", "消费数量"); dgv.Columns.Add("TotalMoney", "应收"); dgv.Columns["ConsumeName"].Width = dgvConsumeDetail.Columns["ConsumeName"].Width; dgv.Columns["UnitPrice"].Width = dgvConsumeDetail.Columns["UnitPrice"].Width; dgv.Columns["Unit"].Width = dgvConsumeDetail.Columns["Unit"].Width; dgv.Columns["Number"].Width = dgvConsumeDetail.Columns["Number"].Width; dgv.Columns["TotalMoney"].Width = dgvConsumeDetail.Columns["TotalMoney"].Width; dgv.Width = dgv.Columns["ConsumeName"].Width + dgv.Columns["UnitPrice"].Width + dgv.Columns["Unit"].Width + dgv.Columns["Number"].Width + dgv.Columns["TotalMoney"].Width; dgv.AllowUserToAddRows = false; int i = 0; foreach (DataGridViewRow dgvr in dgvConsumeDetail.Rows) { dgv.Rows.Add(); dgv.Rows[i].Cells["ConsumeName"].Value = dgvr.Cells["ConsumeName"].Value; dgv.Rows[i].Cells["UnitPrice"].Value = dgvr.Cells["UnitPrice"].Value; dgv.Rows[i].Cells["Unit"].Value = dgvr.Cells["Unit"].Value; dgv.Rows[i].Cells["Number"].Value = dgvr.Cells["Number"].Value; dgv.Rows[i].Cells["TotalMoney"].Value = dgvr.Cells["TotalMoney"].Value; i++; } dgv.Rows.Add(); //dgv.Rows[i].Cells["ConsumeName"].Value = "合计:"; //dgv.Rows[i].Cells["UnitPrice"].Value = dTotal.ToString(); //dgv.Rows[i].Cells["Unit"].Value = "找零:"; //dgv.Rows[i].Cells["Number"].Value = listCustomerStay[0].Deposit - dTotal; dgv.Rows[i].Cells["ConsumeName"].Value = "合计:"; dgv.Rows[i].Cells["UnitPrice"].Value = dTotal.ToString(); dgv.Rows[i].Cells["Unit"].Value = "押金:"; dgv.Rows[i].Cells["Number"].Value = +listCustomerStay[0].Deposit; dgv.Rows[i].Cells["TotalMoney"].Value = "找零:" + (listCustomerStay[0].Deposit - dTotal).ToString(); if (dgvConsumeDetail.Rows.Count > 0) { PrintInfo bPrint = new PrintInfo(); PrintModel mPrint = new PrintModel(); mPrint = bPrint.GetPrintModel(new PrintModel("FormPayMoney"), new ObjectControls(MCtrl.ByPrintNo)); CommonModel mComm = new CommonModel(); mPrint = bPrint.GetPrintSet(mPrint, new Object[] { UserInfo }); DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv }); dgvp.GetPrintConfig = mPrint; dgvp.Print(true, false); } }
private void buttonRemoveObject_Click(object sender, EventArgs e) { PrintModel model = (PrintModel)((Button)sender).Tag; cont.models.Remove(model); RemoveObject(model); autosizeFailed = false; Main.main.threedview.UpdateChanges(); }
public GCodeConverterModel(PrinterModel PrinterModel, PrintModel PrintModel, RealTimeStatusDataModel RealTimeStatusDataModel, ErrorListViewModel ErrorListViewModel) { _printerModel = PrinterModel; _printModel = PrintModel; _realTimeStatusDataModel = RealTimeStatusDataModel; _errorListViewModel = ErrorListViewModel; InstantiateGCodeConverterClasses(); }
public IHttpActionResult PostPrintFile([FromBody] PrintModel printModel) { if (ModelState.IsValid) { var fileStream = Convert.FromBase64String(printModel.Base64File); var printManager = new PrintManager(fileStream); return(Ok()); } return(BadRequest("")); }
private void toolStripInfo_Click(object sender, EventArgs e) { PrintModel act = SingleSelectedModel; if (act == null) { return; } ObjectInformation.Execute(act); }
public void SetObjectSelected(PrintModel model, bool select) { foreach (ListViewItem item in listObjects.Items) { if (item.Tag == model) { item.Selected = select; } } }
static void Main(string[] args) { var host = InitConfig(); var svc = ActivatorUtilities.CreateInstance <CommertialObtimizer>(host.Services); var printSvc = ActivatorUtilities.CreateInstance <PrintModelService>(host.Services); PrintModel printModel = svc.FindOptimalPlacement(); printSvc.Print(printModel); }
/// <summary> /// 选择标签改变事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { groupBox3.Text = "预览:" + tcLabel.SelectedTab.Text; pBoxShow.Image = null; pm = null; //Application.DoEvents(); //改变printDoucment1的画布大小 if (tcLabel.SelectedTab == tpDrug || tcLabel.SelectedTab == tpFood || tcLabel.SelectedTab == tpDPM || tcLabel.SelectedTab == tpHK) { printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("cp", 252, 195); } else if (tcLabel.SelectedTab == tpPack) { printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("bc", 200, 98); } else { printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("wl", 400, 400); } }
/// <summary> /// 画一维条码 /// </summary> /// <param name="g1"></param> /// <param name="pm"></param> /// <param name="barcodeEncoder"></param> private void drawOneImage(Graphics g1, PrintModel pm,Point point) { if (pm.CBarCode != null && pm.CBarCode != "") { Ean13 ean13 = new Ean13(pm.CBarCode.Substring(0, 3), pm.CBarCode.Substring(3, 5), pm.CBarCode.Substring(8, 4), pm.CBarCode.Substring(12, 1)); ean13.Scale = 1.0F; ean13.DrawEan13Barcode(g1,point); } }