// 保存文件
    public static void New_File()
    {
        if (ReportChange_Flag)
        {
            DialogResult _save = MessageBox.Show("是否保存报表文件?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
            if (_save.ToString().Equals("Yes"))
            {
                Save_File();
            }
            if (_save.ToString().Equals("Cancel"))
            {
                return;
            }
        }

        ReportFile_Name.Text = "MyReport.rpt";

        SerializerObject.Clear();
        DraggableObjects.Clear();
        recordObjects.Clear();
        control_Num = -1;

        page_Container.VerticalScroll.Value   = 0;
        page_Container.HorizontalScroll.Value = 0;
        page_TypeFace.Page_Type      = 4;
        page_TypeFace.Page_Direction = 0;
        Set_PrintPageType(4, page_TypeFace.Page_Direction);

        int height = 120;
        int ly     = 0;

        for (int i = 0; i < 3; i++)
        {
            if (i == 0)
            {
                height = 120; ly = 0;
            }
            else if (i == 1)
            {
                height = 250; ly = 128;
            }
            else if (i == 2)
            {
                height = 120; ly = page_TypeFace.Page_Area.Height - height;
            }
            DraggableBandObjects[i].Region = new Rectangle(0, ly, page_TypeFace.Page_Area.Width, height);
        }

        page_Install.Size = new Size(page_TypeFace.Page_Area.Width + 20, page_TypeFace.Page_Area.Height + 20);
        int _iLeft = (page_Container.Width / 2) - (page_TypeFace.Page_Area.Width / 2);

        if (_iLeft < 0)
        {
            _iLeft = 0;
        }
        page_Install.Location = new Point(_iLeft, 0);

        page_Install.Invalidate();
        Print_PageType.Size = page_TypeFace.Page_Area;
        Print_PageType.Invalidate();
        ReportChange_Flag = false;
    }
    // 打开文件
    public static void Open_File()
    {
        OpenFileDialog ofd = new OpenFileDialog();

        ofd.Filter           = "报表文件(*.rpt)|*.rpt";
        ofd.FilterIndex      = 1;
        ofd.RestoreDirectory = true;

        if (ofd.ShowDialog() == DialogResult.OK)
        {
            if (ReportChange_Flag)
            {
                DialogResult _save = MessageBox.Show("是否保存报表文件?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (_save.ToString().Equals("Yes"))
                {
                    Save_File();
                }
                if (_save.ToString().Equals("Cancel"))
                {
                    return;
                }
            }
            SerializerObject.Clear();
            string localFilePath = ofd.FileName.ToString();
            ReportFile_Name.Text = localFilePath;
            try
            {
                SerializerObject = Serializer.FileToObject <List <OperationObject> >(localFilePath);

                DraggableObjects.Clear();
                recordObjects.Clear();
                control_Num = -1;

                int _select = 0;
                for (int i = 0; i < SerializerObject.Count; i++)
                {
                    Draggable draggableBlock = new Draggable(SerializerObject[i].Region.Left, SerializerObject[i].Region.Top, SerializerObject[i].ControlType);
                    draggableBlock.Id          = SerializerObject[i].Id;
                    draggableBlock.Belong_Band = SerializerObject[i].Belong_Band;
                    draggableBlock.Region      = SerializerObject[i].Region;
                    draggableBlock.isContent   = SerializerObject[i].isContent;
                    if (SerializerObject[i].ControlType == 2)
                    {
                        draggableBlock.Field_Img = Base64StringToImage(SerializerObject[i].Field_ImgBase64);
                    }
                    draggableBlock.Field_Text          = SerializerObject[i].Field_Text;
                    draggableBlock.Field_Calculate     = SerializerObject[i].Field_Calculate;
                    draggableBlock.Field_TextFont      = SerializerObject[i].Field_TextFont;
                    draggableBlock.Field_TextFontSize  = SerializerObject[i].Field_TextFontSize;
                    draggableBlock.Field_TextFontStyle = (FontStyle)Enum.Parse(typeof(FontStyle), SerializerObject[i].Field_TextFontStyleString);
                    draggableBlock.Field_Align         = SerializerObject[i].Field_Align;
                    draggableBlock.Field_ImgZoom       = SerializerObject[i].Field_ImgZoom;
                    for (int t = 0; t < 8; t++)
                    {
                        draggableBlock.Field_BoxLine[t] = SerializerObject[i].Field_BoxLine[t];
                    }
                    draggableBlock.Field_LineColor     = ColorTranslator.FromHtml(SerializerObject[i].Field_LineColorString);
                    draggableBlock.Field_LineThickness = SerializerObject[i].Field_LineThickness;
                    draggableBlock.Field_LineType      = SerializerObject[i].Field_LineType;
                    draggableBlock.Field_Shape         = SerializerObject[i].Field_Shape;
                    draggableBlock.Field_ControlColor  = ColorTranslator.FromHtml(SerializerObject[i].Field_ControlColorString);
                    draggableBlock.Field_BackColor     = ColorTranslator.FromHtml(SerializerObject[i].Field_BackColorString);
                    DraggableObjects.Add(draggableBlock);

                    control_Num = i;
                    if (i == SerializerObject.Count - 1)
                    {
                        _select = 1;
                    }
                    DraggableObjects[i].Setimage = LinBox(SerializerObject[i].Region.Width, SerializerObject[i].Region.Height, _select, SerializerObject[i].ControlType, i);
                }

                page_TypeFace = SerializerObject[0].page_Type;
                _pgselect     = page_TypeFace.Page_Type;

                for (int i = 0; i < 3; i++)
                {
                    DraggableBandObjects[i].Region = SerializerObject[0].Band_Region[i];
                }

                Print_PageType.Size = page_TypeFace.Page_Area;

                int _iLeft = (page_Container.Width / 2) - (page_TypeFace.Page_Area.Width / 2);
                if (_iLeft < 0)
                {
                    _iLeft = 0;
                }
                page_Install.Size     = new Size(page_TypeFace.Page_Area.Width + 20, page_TypeFace.Page_Area.Height + 20);
                page_Install.Location = new Point(_iLeft, 0);

                // 设置预览页面大小
                PreViewPage_Area = new Size(page_TypeFace.Page_Area.Width, page_TypeFace.Page_Area.Height - 126);

                Print_PageType.Invalidate();
                RBuild_Info.set_Info(DraggableObjects[control_Num].ControlType);

                ReportChange_Flag = false;
            }

            catch
            {
                MessageBox.Show("报表打开错误!");
            }
        }
    }
    private void acceptSet_Click(object sender, EventArgs e)
    {
        Label pL = (Label)sender;

        if ((int)pL.Tag == 1)
        {
            _pgselect = _record;
            setPage_Form._formObject.Close();
        }
        else
        {
            for (int i = 0; i < 4; i++)
            {
                page_TypeFace.Page_Margin[i] = int.Parse(input_Margin[i].textBox.Text.Trim());
            }
            page_TypeFace.Page_Type = _pgselect;

            if ((_record != _pgselect) || (input_def[0].textBox.Text != page_TypeFace.Rect_mm[0]) || (input_def[1].textBox.Text != page_TypeFace.Rect_mm[1]) || (page_TypeFace.Page_Direction != _pgdirect))
            {
                RBuild_Info.Set_DefaultInfo();
                DraggableObjects.Clear();
                control_Num = -1;

                page_Container.VerticalScroll.Value   = 0;
                page_Container.HorizontalScroll.Value = 0;

                if (_pgselect == -1)
                {
                    page_TypeFace.Page_Area.Width  = (int)Math.Floor(int.Parse(input_def[0].textBox.Text) * 3.779527559055118);
                    page_TypeFace.Page_Area.Height = (int)Math.Floor(int.Parse(input_def[1].textBox.Text) * 3.779527559055118) + 13 + 126;
                    page_TypeFace.Rect_mm[0]       = input_def[0].textBox.Text;
                    page_TypeFace.Rect_mm[1]       = input_def[1].textBox.Text;
                }
                else
                {
                    Set_PrintPageType(_pgselect, _pgdirect);
                    page_TypeFace.Rect_mm[0] = "";
                    page_TypeFace.Rect_mm[1] = "";
                }
                // 设置预览页面大小
                PreViewPage_Area = new Size(page_TypeFace.Page_Area.Width, page_TypeFace.Page_Area.Height - 126);// 去掉-126

                int height = 120;
                int ly     = 0;
                for (int i = 0; i < 3; i++)
                {
                    if (i == 0)
                    {
                        height = 120; ly = 0;
                    }
                    else if (i == 1)
                    {
                        height = 250; ly = 128;
                    }
                    else if (i == 2)
                    {
                        height = 120; ly = page_TypeFace.Page_Area.Height - height;
                    }
                    DraggableBandObjects[i].Region = new Rectangle(0, ly, page_TypeFace.Page_Area.Width, height);
                }

                page_Install.Size = new Size(page_TypeFace.Page_Area.Width + 20, page_TypeFace.Page_Area.Height + 20);
                int _iLeft = (page_Container.Width / 2) - (page_TypeFace.Page_Area.Width / 2);
                if (_iLeft < 0)
                {
                    _iLeft = 0;
                }
                page_Install.Location = new Point(_iLeft, 0);
                page_Install.Invalidate();

                Print_PageType.Size = page_TypeFace.Page_Area;
            }
            RBuild_Info.Set_CompositeLocation();
            setPage_Form._formObject.Close();
        }
        Print_PageType.Invalidate();
    }