示例#1
0
        //Új keret hozzáadása
        private void RectButton_Click(object sender, EventArgs e)
        {
            SimplineObject FO = new FrameObject();

            panel1.Controls.Add(FO);
            SOList.Add(FO);
            FO.SendToBack();
        }
示例#2
0
        //Kijelölt objektumok klónozása
        private void CopyPasteButton_Click(object sender, EventArgs e)
        {
            List <SimplineObject> temp = new List <SimplineObject>();

            foreach (SimplineObject SO in SOList)
            {
                temp.Add(SO);
            }
            foreach (SimplineObject SO in temp)
            {
                if (SO.Name.Contains("*"))
                {
                    SimplineObject SOclone;
                    if (SO is PictureObject)
                    {
                        SOclone = new PictureObject(((PictureObject)SO).getPicture());
                    }
                    else if (SO is BarcodeObject)
                    {
                        SOclone = new BarcodeObject(((BarcodeObject)SO).getCodeType(), ((BarcodeObject)SO).getCodeValue());
                    }
                    else if (SO is LabelObject)
                    {
                        SOclone = new LabelObject(((LabelObject)SO).getLabFont(), ((LabelObject)SO).getLabValue(), ((LabelObject)SO).getLabSize().ToString());
                    }
                    else
                    {
                        SOclone = new FrameObject();
                    }
                    SOclone.BackgroundImage = SO.BackgroundImage;
                    SOclone.Height          = SO.Height;
                    SOclone.Width           = SO.Width;
                    panel1.Controls.Add(SOclone);
                    SOList.Add(SOclone);
                }
            }
        }
示例#3
0
        public void LoadTxt()
        {
            SimplineObject SO;
            string         line;
            int            i;

            p.Controls.Clear();
            SOList.Clear();
            using (OpenFileDialog ofd = new OpenFileDialog()
            {
                Filter = "Txt file|*.txt", ValidateNames = true, Title = "Open a txt file"
            })
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    using (StreamReader sr = new StreamReader(ofd.FileName))
                    {
                        try
                        {
                            while ((line = sr.ReadLine()) != null)
                            {
                                i = 0;
                                string[] parameters = line.Split(';');
                                switch (parameters[i])
                                {
                                case "PictureObject":
                                    SO = new PictureObject(parameters[1]);
                                    i  = i + 2;
                                    break;

                                case "BarcodeObject":
                                    SO = new BarcodeObject(parameters[1], parameters[2]);
                                    i  = i + 3;
                                    break;

                                case "LabelObject":
                                    SO = new LabelObject(parameters[1], parameters[2], parameters[3]);
                                    ((LabelObject)SO).setLabX(Convert.ToInt32(parameters[4]));
                                    ((LabelObject)SO).setLabY(Convert.ToInt32(parameters[5]));
                                    i = i + 6;
                                    break;

                                default:
                                    SO = new FrameObject();
                                    i++;
                                    break;
                                }
                                SO.setX(Convert.ToInt32(parameters[i]));
                                SO.setY(Convert.ToInt32(parameters[i + 1]));
                                SO.Height = Convert.ToInt32(parameters[i + 2]);
                                SO.Width  = Convert.ToInt32(parameters[i + 3]);
                                if (SO is BarcodeObject)
                                {
                                    ((BarcodeObject)SO).setNewCode(parameters[1], parameters[2]);
                                }
                                if (SO is FrameObject || parameters[parameters.Length - 1] == "1")
                                {
                                    SO.BorderStyle = BorderStyle.FixedSingle;
                                }
                                SOList.Add(SO);
                                p.Controls.Add(SO);
                            }
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("Hiba a fájl megnyitása során: " + ex.Message + "\nEllenőrizze a megnyitni kívánt fájl szerkezetét!");
                        }
                    }
                }
            }
        }