Example #1
0
 /// <summary>
 /// 重做实验
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button2_Click(object sender, EventArgs e)
 {
     lists.Clear();
     sy5_Lists.Clear();
     this.dataGridView1.DataSource = new BindingList <Sy5_List>(sy5_Lists);
     Export_All_SY.DBDel(tb);
 }
        static iTextSharp.text.Font fonttitle3 = new iTextSharp.text.Font(bf1, 10);    //表格內容字体,大小15
        public static void Exp_SY1_SY2()
        {
            PdfReader pdfReader; PdfStamper pdfStamper; AcroFields pdfFormFields;
            BaseFont  bf1 = BaseFont.CreateFont("C:\\Windows\\Fonts\\SIMSUN.TTC,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            //文件保存的真正路径
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            string path = AppDomain.CurrentDomain.BaseDirectory;
            int    flag = 1;

            path = System.IO.Directory.GetParent(path).Parent.Parent.FullName + "\\SY1_SY2_MB.pdf";
            //MessageBox.Show(path);
            pdfReader                 = new PdfReader(path);//模板的路径
            pdfStamper                = new PdfStamper(pdfReader, new FileStream(tempname, FileMode.OpenOrCreate));
            pdfFormFields             = pdfStamper.AcroFields;
            pdfStamper.FormFlattening = true;
            pdfFormFields.AddSubstitutionFont(bf1);
            dtb = Export_All_SY.DBQuery("Sy1_Fdsk");
            Export_All_SY.DBDel("Sy1_Fdsk");
            Export_Table_Design.SY1_Table(pdfFormFields, ref flag, dtb);
            flag = 1;
            dtb  = Export_All_SY.DBQuery("Sy2_Gzzd");
            Export_All_SY.DBDel("Sy2_Gzzd");
            Export_Table_Design.SY2_Table(pdfFormFields, ref flag, dtb);
            pdfStamper.Close();
            pdfReader.Close();
        }
        public static void Exp_HPSY()
        {
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document document = new Document();

            document.SetPageSize(PageSize.A4.Rotate());  //  设置文档为横向
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            document.NewPage();
            table = new PdfPTable(13);//  设计试验8的表格总共有13列
            table.WidthPercentage = 100;
            Paragraph Title1 = new Paragraph("7. 滑板控制装置(I型车)火炮联锁试验记录", fonttitle);

            Title1.SetAlignment("center");
            document.Add(Title1);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;  //此数值用于调整空白大小0
            document.Add(nullb);
            dtb   = Export_All_SY.DBQuery("SY8_Hplx");
            table = Export_Table_Design.SY8_Table(table, dtb);
            Export_All_SY.DBDel("SY8_Hplx");
            document.Add(table);  //將table放到pdf文件中
            Title1 = new Paragraph("注:试验中“√”表示动作正常,“×”表示动作异常", fonttitle3);
            document.Add(Title1); //将标题段加入PDF文档中
            document.Close();
        }
        public static void Exp_SY6()
        {
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document document = new Document();

            document.SetPageSize(PageSize.A4.Rotate());  //  设置文档为横向
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            document.NewPage();
            table = new PdfPTable(21);//  设计试验6的表格总共有21列
            table.WidthPercentage = 100;
            Paragraph Title = new Paragraph("6. 滑板控制装置系统调试精度试验记录", fonttitle);

            Title.SetAlignment("center");
            document.Add(Title);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;  //此数值用于调整空白大小0
            document.Add(nullb);
            dtb   = Export_All_SY.DBQuery("SY6_Xtts");
            table = Export_Table_Design.SY6_Table(table, dtb);
            Export_All_SY.DBDel("SY6_Xtts");
            document.Add(table);//將table放到pdf文件中
            Title = new Paragraph("注:表中θ表示尾翼板角度,β表示首下板角度,φ表示首上板角度", fonttitle3);
            Title.SetAlignment("center");
            document.Add(Title); //将标题段加入PDF文档中
            document.Close();
        }
        /// <summary>
        /// 重做试验按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            sy3_Lists.Clear();
            count_num = 0;
            this.dataGridView1.DataSource = new BindingList <Sy3_List>(sy3_Lists);
            string tb = "[SY3_Timer]";

            Export_All_SY.DBDel(tb);
        }
        public static void Exp_SY3_SY4()
        {
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document  document = new Document();
            PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            table = new PdfPTable(3);//  设计试验3的表格总共有3列
            table.WidthPercentage = 82;
            table.SetTotalWidth(new float[] { 100f, 200f, 250f });
            ///表頭設計
            //添加段落,第二个参数指定使用fonttitle格式的字体,写入中文必须指定字体否则无法显示中文
            Paragraph Title = new Paragraph("3. 滑板控制装置首板收板时间试验记录", fonttitle);

            Title.SetAlignment("center");                       //设置居中
            document.Add(Title);                                //将标题段加入PDF文档中
                                                                //空一行
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;                                 //此数值用于调整空白大小0
            document.Add(nullb);
            DataTable dtb = Export_All_SY.DBQuery("SY3_Timer"); //表格3设计单独做一个函数

            table = Export_Table_Design.SY3_Table(table, dtb);
            Export_All_SY.DBDel("SY3_Timer");
            document.Add(table);
            //空一行
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 60;       //此数值用于调整空白大小0
            document.Add(nullb);
            table = new PdfPTable(5); //  设计试验4的表格总共有5列
            table.WidthPercentage = 82;
            table.SetTotalWidth(new float[] { 100f, 200f, 200f, 200f, 200f });
            Title = new Paragraph("4. 滑板控制装置连续收板(手动20次)试验记录", fonttitle);
            Title.SetAlignment("center");
            document.Add(Title);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;                        //此数值用于调整空白大小0
            document.Add(nullb);
            dtb   = Export_All_SY.DBQuery("SY4_Lxsb"); //表格4设计单独做一个函数
            table = Export_Table_Design.SY4_Table(table, dtb);
            Export_All_SY.DBDel("SY4_Lxsb");
            document.Add(table); //將table放到pdf文件中
            Title = new Paragraph("         注:试验中“√”表示动作正常,“×”表示动作异常", fonttitle3);
            document.Add(Title); //将标题段加入PDF文档中
            document.Close();
        }
        public static void Exp_SY7()
        {
            Paragraph Title;
            String    tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            Document  document = new Document();
            PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(tempname, FileMode.Create));

            document.Open();
            table = new PdfPTable(2);//  设计试验7的表格总共有6列
            table.WidthPercentage = 100;
            if (MainFrom.comBoxData_Form == "HBK-II/1")
            {
                Title = new Paragraph("7. 滑板控制装置连续收板(程控20次)试验记录", fonttitle);
            }
            else
            {
                Title = new Paragraph("8. 滑板控制装置连续收板(程控20次)试验记录", fonttitle);
            }
            Title.SetAlignment("center");
            document.Add(Title);
            nullb         = new Paragraph(" ", fonttitle2);
            nullb.Leading = 10;  //此数值用于调整空白大小0
            document.Add(nullb);
            int       flag   = 1;
            PdfPTable table1 = new PdfPTable(6);
            PdfPTable table2 = new PdfPTable(6);

            dtb    = Export_All_SY.DBQuery("SY7_Lxsb_Ck");
            table1 = Export_Table_Design.SY7_Table1(table1, ref flag, dtb); //表格7设计单独做一个函数
            table2 = Export_Table_Design.SY7_Table2(table2, ref flag, dtb); //表格7设计单独做一个函数
            Export_All_SY.DBDel("SY7_Lxsb_Ck");
            cell1         = new PdfPCell(table1);
            cell1.Padding = 0;
            table.AddCell(cell1);
            cell1         = new PdfPCell(table2);
            cell1.Padding = 0.5f;
            table.AddCell(cell1);
            document.Add(table); //將table放到pdf文件中
            Title = new Paragraph("  注:试验中“√”表示动作正常,“×”表示动作异常", fonttitle3);
            document.Add(Title); //将标题段加入PDF文档中
            document.Close();
        }
 /// <summary>
 /// 重新试验
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button4_Click(object sender, EventArgs e)
 {
     C_no = 1;
     //数据库
     Export_All_SY.DBDel(tb);
 }
 private void button1_Click(object sender, EventArgs e)
 {
     Export_All_SY.DBDel(tb);
 }
Example #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            string tb = "[SY4_Lxsb]";

            Export_All_SY.DBDel(tb);
            ////////////////////////////////////////////////////////
            ///以下代码为了更改下拉菜单内容
            count = getCount();
            this.cobB1.Items.Clear();
            switch (count)
            {
            case 0:
                string[] items0 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };
                this.cobB1.Items.AddRange(items0);
                break;

            case 1:
                string[] items1 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" };
                this.cobB1.Items.AddRange(items1);
                break;

            case 2:
                string[] items2 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18" };
                this.cobB1.Items.AddRange(items2);
                break;

            case 3:
                string[] items3 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17" };
                this.cobB1.Items.AddRange(items3);
                break;

            case 4:
                string[] items4 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" };
                this.cobB1.Items.AddRange(items4);
                break;

            case 5:
                string[] items5 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
                this.cobB1.Items.AddRange(items5);
                break;

            case 6:
                string[] items6 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14" };
                this.cobB1.Items.AddRange(items6);
                break;

            case 7:
                string[] items7 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" };
                this.cobB1.Items.AddRange(items7);
                break;

            case 8:
                string[] items8 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" };
                this.cobB1.Items.AddRange(items8);
                break;

            case 9:
                string[] items9 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" };
                this.cobB1.Items.AddRange(items9);
                break;

            case 10:
                string[] items10 = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
                this.cobB1.Items.AddRange(items10);
                break;

            case 11:
                string[] items11 = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
                this.cobB1.Items.AddRange(items11);
                break;

            case 12:
                string[] items12 = { "1", "2", "3", "4", "5", "6", "7", "8" };
                this.cobB1.Items.AddRange(items12);
                break;

            case 13:
                string[] items13 = { "1", "2", "3", "4", "5", "6", "7" };
                this.cobB1.Items.AddRange(items13);
                break;

            case 14:
                string[] items14 = { "1", "2", "3", "4", "5", "6" };
                this.cobB1.Items.AddRange(items14);
                break;

            case 15:
                string[] items15 = { "1", "2", "3", "4", "5" };
                this.cobB1.Items.AddRange(items15);
                break;

            case 16:
                string[] items16 = { "1", "2", "3", "4" };
                this.cobB1.Items.AddRange(items16);
                break;

            case 17:
                string[] items17 = { "1", "2", "3" };
                this.cobB1.Items.AddRange(items17);
                break;

            case 18:
                string[] items18 = { "1", "2" };
                this.cobB1.Items.AddRange(items18);
                break;

            case 19:
                string[] items19 = { "1" };
                this.cobB1.Items.AddRange(items19);
                break;

            case 20:
                string[] items20 = { };
                this.cobB1.Items.AddRange(items20);
                this.cobB1.Text = "0";
                break;
            }
        }