Esempio n. 1
0
        //Main Functions
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                newpaperdef    = new ACA.LabelX.Paper.PaperDef();
                newpaperdef.ID = idtxt.Text;
                newpaperdef.coordinateSystem = new CoordinateSystem(Convert.ToUInt32(DPIXtxt.Text), Convert.ToUInt32(DPIYtxt.Text), unitcombo.SelectedItem.ToString());
                newpaperdef.size             = new ACA.LabelX.Tools.Size(new Length(Convert.ToSingle(sizextxt.Text, CultureInfo.InvariantCulture), newpaperdef.coordinateSystem.units), new Length(Convert.ToSingle(sizeytxt.Text), newpaperdef.coordinateSystem.units));

                ACA.LabelX.Paper.LabelLayout templabellayout = new ACA.LabelX.Paper.LabelLayout(newpaperdef.coordinateSystem.units);
                templabellayout.LeftMargin              = new Length(Convert.ToSingle(horzmargintxt.Text, CultureInfo.InvariantCulture), newpaperdef.coordinateSystem.units);
                templabellayout.TopMargin               = new Length(Convert.ToSingle(vertmargintxt.Text, CultureInfo.InvariantCulture), newpaperdef.coordinateSystem.units);
                templabellayout.HorizontalCount         = Convert.ToUInt32(nrhorzlblstxt.Text);
                templabellayout.VerticalCount           = Convert.ToUInt32(nrvertlblstxt.Text);
                templabellayout.HorizontalInterlabelGap = new Length(Convert.ToSingle(horzgaptxt.Text, CultureInfo.InvariantCulture), newpaperdef.coordinateSystem.units);
                templabellayout.VerticalInterlabelGap   = new Length(Convert.ToSingle(vertgaptxt.Text, CultureInfo.InvariantCulture), newpaperdef.coordinateSystem.units);

                newpaperdef.labelLayout = templabellayout;

                //Add default offset to local offsets
                Offset tempDefaultOffset = new Offset(newpaperdef.coordinateSystem.units);
                tempDefaultOffset.LeftMarginOffset = new Length(Convert.ToSingle(defhorzoffsettxt.Text, CultureInfo.InvariantCulture), newpaperdef.coordinateSystem.units);
                tempDefaultOffset.TopMarginOffset  = new Length(Convert.ToSingle(defvertoffsettxt.Text, CultureInfo.InvariantCulture), newpaperdef.coordinateSystem.units);
                tempDefaultOffset.Machine          = "";
                tempDefaultOffset.Printer          = "";
                if (LocalOffsets.ContainsKey("@"))
                {
                    LocalOffsets.Remove("@");
                }
                LocalOffsets.Add("@", tempDefaultOffset);

                //Add all offsets to new paper
                newpaperdef.Offsets = LocalOffsets;


                if (mode == Mode.edit)
                {
                    File.Delete(paperDefinitionRootFolder + @"\" + newpaperdef.ID + @".xml");
                }
                savePaperDefTo(paperDefinitionRootFolder + @"\" + newpaperdef.ID + @".xml");
                PaperType    = newpaperdef.ID;
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show(GetString("INVALIDINPUTERROR"), GetString("INVALIDINPUTERRORTITLE"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        public NewPaperTypeForm(string paperDefinitionRootFolder, ACA.LabelX.Paper.PaperDef paperDefToEdit)
            : this(paperDefinitionRootFolder)
        {
            mode = Mode.edit;
            this.paperDefToEdit = paperDefToEdit;
            LocalOffsets        = paperDefToEdit.Offsets;
            idtxt.Text          = paperDefToEdit.ID;
            idtxt.Enabled       = false;

            DPIXtxt.Text      = paperDefToEdit.coordinateSystem.dpiFactor.X.ToString();
            DPIYtxt.Text      = paperDefToEdit.coordinateSystem.dpiFactor.Y.ToString();
            unitcombo.Enabled = false;
            DPIXtxt.Enabled   = false;
            DPIYtxt.Enabled   = false;

            sizextxt.Text      = paperDefToEdit.size.Width.length.ToString();
            sizeytxt.Text      = paperDefToEdit.size.Height.length.ToString();
            horzmargintxt.Text = paperDefToEdit.labelLayout.LeftMargin.length.ToString();
            vertmargintxt.Text = paperDefToEdit.labelLayout.TopMargin.length.ToString();
            nrhorzlblstxt.Text = paperDefToEdit.labelLayout.HorizontalCount.ToString();
            nrvertlblstxt.Text = paperDefToEdit.labelLayout.VerticalCount.ToString();
            horzgaptxt.Text    = paperDefToEdit.labelLayout.HorizontalInterlabelGap.length.ToString();
            vertgaptxt.Text    = paperDefToEdit.labelLayout.VerticalInterlabelGap.length.ToString();

            string defhorzoffsetstr = "0";
            string defvertoffsetstr = "0";
            if (LocalOffsets.ContainsKey("@"))
            {
                defhorzoffsetstr = LocalOffsets["@"].LeftMarginOffset.length.ToString();
                defvertoffsetstr = LocalOffsets["@"].TopMarginOffset.length.ToString();
            }
            defhorzoffsettxt.Text = defhorzoffsetstr;
            defvertoffsettxt.Text = defvertoffsetstr;

            //Specific Offsets Tab
            RefreshSpecOffsetListBox("");
        }