//Main functions private void Okbtn_Click(object sender, EventArgs e) { if (inputCheck()) { if (concatmethodcombo.SelectedItem.ToString().Equals("Horizontal", StringComparison.OrdinalIgnoreCase)) { textfieldgroup = new LabelDef.TextFieldGroup(new CoordinateSystem(Convert.ToUInt32(mainForm.CreateGraphics().DpiX), Convert.ToUInt32(mainForm.CreateGraphics().DpiY), "Millimeter"), LabelDef.TextFieldGroup.ConcatMethod.Horizontal); } else { textfieldgroup = new LabelDef.TextFieldGroup(new CoordinateSystem(Convert.ToUInt32(mainForm.CreateGraphics().DpiX), Convert.ToUInt32(mainForm.CreateGraphics().DpiY), "Millimeter"), LabelDef.TextFieldGroup.ConcatMethod.Vertical); } textfieldgroup.ID = IDtxt.Text; textfieldgroup.PositionX = new Length(System.Convert.ToInt32(XPostxt.Text), System.Drawing.GraphicsUnit.Millimeter); textfieldgroup.PositionY = new Length(System.Convert.ToInt32(YPostxt.Text), System.Drawing.GraphicsUnit.Millimeter); textfieldgroup.Rotation = System.Convert.ToInt32(rotationcombo.SelectedItem.ToString()); if (manualwhcheck.Checked) { textfieldgroup.Height = new Length(System.Convert.ToInt32(heighttxt.Text), System.Drawing.GraphicsUnit.Millimeter); textfieldgroup.Width = new Length(System.Convert.ToInt32(widthtxt.Text), System.Drawing.GraphicsUnit.Millimeter); } LabelDef.StringFormat stringformat = new LabelDef.StringFormat(); if (alignTextcombo.SelectedItem.ToString().Equals(GetString("LEFT"), StringComparison.OrdinalIgnoreCase)) { stringformat.Align = LabelDef.FieldFormat.Alignment.Left; } else { stringformat.Align = LabelDef.FieldFormat.Alignment.Right; } textfieldgroup.printFormat = new LabelDef.PrintFormat(stringformat); IList <LabelDef.TextField> addedtextfieldlist = new List <LabelDef.TextField>(); foreach (string textfieldIDToAdd in addedtextfieldslist.Items) { LabelDef.Field fieldvalue; referencelist.TryGetValue(textfieldIDToAdd, out fieldvalue); LabelDef.TextField textfieldvalue = (LabelDef.TextField)fieldvalue; textfieldgroup.fields.Add(textfieldvalue); } DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show(GetString("INVALIDINPUTERROR"), GetString("INVALIDINPUTERRORTITLE"), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void typecombo_SelectionChangeCommitted(object sender, System.EventArgs e) { if (typecombo.SelectedItem.ToString().Equals("Text", StringComparison.OrdinalIgnoreCase)) { LabelDef.StringFormat newformat = new LabelDef.StringFormat(); newformat.FormatString = string.Empty; textField.printFormat.format = newformat; } else if (typecombo.SelectedItem.ToString().Equals("Date", StringComparison.OrdinalIgnoreCase)) { LabelDef.DateTimeFormat newformat = new LabelDef.DateTimeFormat(); newformat.FormatString = textField.printFormat.format.FormatString; textField.printFormat.format = newformat; } else if (typecombo.SelectedItem.ToString().Equals("Decimal:Whole", StringComparison.OrdinalIgnoreCase)) { LabelDef.DecimalFormat newformat = new LabelDef.DecimalFormat(); newformat.Portion = LabelDef.DecimalFormat.DecimalPortion.Entire; newformat.FormatString = textField.printFormat.format.FormatString; textField.printFormat.format = newformat; } else if (typecombo.SelectedItem.ToString().Equals("Decimal:Integer", StringComparison.OrdinalIgnoreCase)) { LabelDef.DecimalFormat newformat = new LabelDef.DecimalFormat(); newformat.Portion = LabelDef.DecimalFormat.DecimalPortion.Integer; newformat.FormatString = textField.printFormat.format.FormatString; textField.printFormat.format = newformat; } else if (typecombo.SelectedItem.ToString().Equals("Decimal:Fraction", StringComparison.OrdinalIgnoreCase)) { LabelDef.DecimalFormat newformat = new LabelDef.DecimalFormat(); newformat.Portion = LabelDef.DecimalFormat.DecimalPortion.Fraction; newformat.FormatString = textField.printFormat.format.FormatString; textField.printFormat.format = newformat; } FillData(textField); mainForm.Invalidate(); }
//Main functions private void button1_Click(object sender, EventArgs e) { try { textfield = new LabelDef.TextField(new ACA.LabelX.Tools.CoordinateSystem(200, 200, GetString("MILLIMETER"))); textfield.ID = IDtxt.Text; textfield.PositionX = new Length(System.Convert.ToInt32(XPostxt.Text), System.Drawing.GraphicsUnit.Millimeter); textfield.PositionY = new Length(System.Convert.ToInt32(YPostxt.Text), System.Drawing.GraphicsUnit.Millimeter); textfield.Rotation = System.Convert.ToInt32(rotationcombo.SelectedItem.ToString()); string selectedfont = Fontcombo.SelectedItem.ToString().Split(' ')[0].Trim(); fontList.TryGetValue(selectedfont, out textfield.Font); if (manualwhcheck.Checked) { textfield.Height = new Length(System.Convert.ToInt32(heighttxt.Text), System.Drawing.GraphicsUnit.Millimeter); textfield.Width = new Length(System.Convert.ToInt32(widthtxt.Text), System.Drawing.GraphicsUnit.Millimeter); } LabelDef.FieldFormat.Alignment alignment = LabelDef.FieldFormat.Alignment.Left; if (alignTextcombo.SelectedItem.ToString().Equals(GetString("LEFT"), StringComparison.OrdinalIgnoreCase)) { alignment = LabelDef.FieldFormat.Alignment.Left; } else if (alignTextcombo.SelectedItem.ToString().Equals(GetString("RIGHT"), StringComparison.OrdinalIgnoreCase)) { alignment = LabelDef.FieldFormat.Alignment.Right; } string formatString = null; if (formatstringlist.SelectedItem == null || formatstringlist.SelectedItem.ToString().Length < 1) { formatString = String.Empty; } else { formatString = formatstringlist.SelectedItem.ToString(); } if (typecombo.SelectedItem.ToString().Equals(GetString("TEXT"), StringComparison.OrdinalIgnoreCase)) { LabelDef.StringFormat stringformat = new LabelDef.StringFormat(); stringformat.Align = alignment; stringformat.FormatString = formatString; stringformat.IsBarcode = false; textfield.printFormat = new LabelDef.PrintFormat(stringformat); } else if (typecombo.SelectedItem.ToString().Equals(GetString("DATE"), StringComparison.OrdinalIgnoreCase)) { LabelDef.DateTimeFormat datetimeformat = new LabelDef.DateTimeFormat(); datetimeformat.Align = alignment; datetimeformat.FormatString = formatString; textfield.printFormat = new LabelDef.PrintFormat(datetimeformat); } else if (typecombo.SelectedItem.ToString().Equals(GetString("DECIMALWHOLE"), StringComparison.OrdinalIgnoreCase)) { LabelDef.DecimalFormat decimalformat = new LabelDef.DecimalFormat(); decimalformat.Align = alignment; decimalformat.FormatString = formatString; decimalformat.Portion = LabelDef.DecimalFormat.DecimalPortion.Entire; textfield.printFormat = new LabelDef.PrintFormat(decimalformat); } else if (typecombo.SelectedItem.ToString().Equals(GetString("DECIMALINTEGER"), StringComparison.OrdinalIgnoreCase)) { LabelDef.DecimalFormat decimalformat = new LabelDef.DecimalFormat(); decimalformat.Align = alignment; decimalformat.FormatString = formatString; decimalformat.Portion = LabelDef.DecimalFormat.DecimalPortion.Integer; textfield.printFormat = new LabelDef.PrintFormat(decimalformat); } else if (typecombo.SelectedItem.ToString().Equals(GetString("DECIMALFRACTION"), StringComparison.OrdinalIgnoreCase)) { LabelDef.DecimalFormat decimalformat = new LabelDef.DecimalFormat(); decimalformat.Align = alignment; decimalformat.FormatString = formatString; decimalformat.Portion = LabelDef.DecimalFormat.DecimalPortion.Fraction; textfield.printFormat = new LabelDef.PrintFormat(decimalformat); } if (referencecombo.SelectedItem.ToString().Equals(GetString("NOTHING"))) { textfield.ValueRef = null; } else { textfield.ValueRef = referencecombo.SelectedItem.ToString(); } DialogResult = DialogResult.OK; this.Close(); } catch { MessageBox.Show(GetString("INVALIDINPUTERROR"), GetString("INVALIDINPUTERRORTITLE"), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Main Function private void Okbtn_Click(object sender, EventArgs e) { try { barcodefield = new LabelDef.BarcodeField(new ACA.LabelX.Tools.CoordinateSystem(200, 200, GetString("MILLIMETER"))); barcodefield.ID = IDtxt.Text; barcodefield.PositionX = new Length(System.Convert.ToInt32(XPostxt.Text), System.Drawing.GraphicsUnit.Millimeter); barcodefield.PositionY = new Length(System.Convert.ToInt32(YPostxt.Text), System.Drawing.GraphicsUnit.Millimeter); barcodefield.Rotation = System.Convert.ToInt32(rotationcombo.SelectedItem.ToString()); barcodefield.Height = new Length(System.Convert.ToInt32(heighttxt.Text), System.Drawing.GraphicsUnit.Millimeter); barcodefield.Width = new Length(System.Convert.ToInt32(widthtxt.Text), System.Drawing.GraphicsUnit.Millimeter); LabelDef.StringFormat stringformat = new LabelDef.StringFormat(true); if (alignTextcombo.SelectedItem.ToString().Equals(GetString("LEFT"), StringComparison.OrdinalIgnoreCase)) { stringformat.Align = LabelDef.FieldFormat.Alignment.Left; } else if (alignTextcombo.SelectedItem.ToString().Equals(GetString("RIGHT"), StringComparison.OrdinalIgnoreCase)) { stringformat.Align = LabelDef.FieldFormat.Alignment.Right; } string barcodetype = typecombo.SelectedItem.ToString(); switch (barcodetype) { case "EAN8": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.EAN8; break; case "EAN13": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.EAN13; break; case "UPCVersionA": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.UPCVersionA; break; case "Code39": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.Code39; break; case "Interleaved2Of5": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.Interleaved2Of5; break; case "EAN128": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.EAN128; break; case "DataMatrix": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.DataMatrix; break; case "PDF417": barcodefield.Type = LabelDef.BarcodeField.BarcodeType.PDF417; break; } barcodefield.MaxCharCount = System.Convert.ToInt32(maxcharcounttxt.Text); barcodefield.printText = showtextcheck.Checked; barcodefield.printFormat = new LabelDef.PrintFormat(stringformat); if (referencecombo.SelectedItem.ToString().Equals(GetString("NOTHING"))) { barcodefield.ValueRef = null; } else { barcodefield.ValueRef = referencecombo.SelectedItem.ToString(); } DialogResult = DialogResult.OK; this.Close(); } catch { MessageBox.Show(GetString("INVALIDINPUTERROR"), GetString("INVALIDINPUTERRORTITLE"), MessageBoxButtons.OK, MessageBoxIcon.Error); } }