Ejemplo n.º 1
0
        private void MakeNewPlate(ShapeRange sr_origin, string[] data, double x, double y)
        {
            string key = data[2];

            //clone to the grid
            corel.Shape      sh_plate    = sr_origin.Shapes.FindShape("plate");
            corel.Shape      sh_pn_orign = sr_origin.Shapes.FindShape("H_第1列");
            corel.ShapeRange sr_new      = sr_origin.Clone();
            sr_new.SetPosition(x, y);

            //replace things
            corel.Shape sh_pn      = sr_new.Shapes.FindShape("H_第1列");
            corel.Text  platenum_1 = sr_new.Shapes.FindShape("H_第2列").Text;
            corel.Shape sh_qrLB    = sr_new.Shapes.FindShape("qrLB");
            corel.Shape sh_qrRT    = sr_new.Shapes.FindShape("qrRT");

            sh_pn.Text.Story.Text = data[0];
            sh_pn.SetSize(sh_pn_orign.SizeWidth, sh_pn_orign.SizeHeight);//resize the font

            if (dict_qrPath.ContainsKey(key))
            {
                myQrcode("a", sh_qrLB, dict_qrPath[key][0]);
                myQrcode("a", sh_qrRT, dict_qrPath[key][1]);
            }

            if (!data[1].Contains("号"))
            {
                platenum_1.Story.Text = data[1];
            }
            else
            {
                string[]    num        = data[1].Split('号');
                corel.Shape platenum_2 = sr_new.Shapes.FindShape("H_第3列");
                platenum_1.Story.Text = num[0];
                //platenum_1.SetSize(sh_num1_orign.SizeWidth, sh_num1_orign.SizeHeight);//resize the font
                platenum_2.Text.Story.Text = "号" + num[1];
                //platenum_2.SetSize(sh_num2_orign.SizeWidth, sh_num2_orign.SizeHeight);//resize the font
            }
        }
Ejemplo n.º 2
0
        //generate a lot of plates
        private void button1_Click(object sender, EventArgs e)
        {
            myOptimize(true, true);
            corel.Shapes     shapes     = corelApp.ActiveSelection.Shapes; //get selected shapes
            corel.Shape      plate      = shapes.FindShape("plate");
            corel.ShapeRange shapeRange = shapes.All();                    // used for clone
            MessageBox.Show(shapeRange.Count.ToString());
            double dx = plate.RightX - plate.LeftX;
            double dy = plate.TopY - plate.BottomY;

            int count = 1;

            for (int x = 1; x < 3; x++)
            {
                for (int y = 1; y < 3; y++)
                {
                    string[]         data         = (string[])datas[count];
                    corel.ShapeRange sr           = shapeRange.Clone(x * dx, y * dy);
                    corel.Shapes     shs          = sr.Shapes;
                    corel.Text       sh_platename = shs.FindShape("H_第1列").Text;
                    corel.Text       sh_platenum  = shs.FindShape("H_第2列").Text;
                    if (sh_platename.IsArtisticText)
                    {
                        //sh_platename.Replace("大氹村前街十二巷", "我卢本伟没有开挂", false, ReplaceAll: true);
                        sh_platename.Story.Text = data[0];
                    }
                    if (sh_platenum.IsArtisticText)
                    {
                        //String num = count.ToString();
                        //sh_platenum.Replace("1", num, false, ReplaceAll: true);
                        sh_platenum.Story.Text = data[1];
                    }
                    count++;
                }
            }
            myOptimize(true, false);
        }