private void twEndXfer(object sender, Twain32.EndXferEventArgs e) { string filename = string.Empty; filename = Guid.NewGuid().ToString(); // string FileNm = mImagePath + filename + ".png"; DataTable dt = new ZLXIBAL().Select112801(pId); if (dt.Rows[0][0].ToString() == "png") { string FileNm = mImagePath + a + "-" + (++cnt).ToString("000") + ".png"; e.Image.Save(FileNm, ImageFormat.Png); } else if (dt.Rows[0][0].ToString() == "jpg") { string FileNm = mImagePath + a + "-" + (++cnt).ToString("000") + ".jpg"; e.Image.Save(FileNm, ImageFormat.Jpeg); } else { string FileNm = mImagePath + a + "-" + (++cnt).ToString("000") + ".tiff"; e.Image.Save(FileNm, ImageFormat.Tiff); } //mImageIndex++; }
private void btn_scaj_Click_1(object sender, EventArgs e) { int[] a = new int[10000]; for (int i = 0; i < 9999; i++) { a[i] = 0; } int j = 0; bool flag1 = false; DialogResult button = MessageBox.Show("确定要删除本条信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (button == DialogResult.Yes) { flag1 = true; } if (flag1 == true) { int count = dataGridView2.Rows.Count; for (int i = 0; i < count - 1; i++) { if (Convert.ToBoolean(dataGridView2.Rows[i].Cells[0].Value) == true) { a[j++] = i; string aname = dataGridView2.Rows[i].Cells["案卷题名"].Value.ToString(); string aId = dataGridView2.Rows[i].Cells["案卷号"].Value.ToString(); DataTable dt = new ZLBAL().Select115(lzId, "11", aId); string bh2 = dt.Rows[0][0].ToString(); bool f = new ZLBAL().Update112("0", lzId, bh2); bool flag = new ZLXIBAL().Delete2("12", aname, pId, bh); bool flag2 = new ZLXIBAL().Delete3("12", aname, pId, bh); //dataGridView2.Rows.RemoveAt(dataGridView2.CurrentCell.RowIndex); if (dataGridView3.ColumnCount > 1) { DataTable tt = (DataTable)dataGridView3.DataSource; tt.Rows.Clear(); dataGridView3.DataSource = tt; } cc2 = 0; } } int s = 0; while (a[s] >= 0) { dataGridView2.Rows.RemoveAt(a[s]); for (int i = s + 1; i < 9999; i++) { a[i] = a[i] - 1; } s++; } copyll = ll; ll = dataGridView2.Rows.Count - 1; } }
private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView3.Columns[e.ColumnIndex].Name == "btnck" && e.RowIndex >= 0) { string str1 = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString(); Form4 form = new Form4(str1, pId); form.ShowDialog(); } else if (dataGridView3.Columns[e.ColumnIndex].Name == "btntc" && e.RowIndex >= 0) { /* p = new Process(); * //需要启动的程序 * p.StartInfo.FileName = @"D:\scan\NAPS2\NAPS2.exe"; * //为了美观,启动的时候最小化程序 * // p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; * //启动 * p.Start();*/ string dangId = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString(); string mImagePath = ""; index = -1; lstImgPath = new List <string>(); DataTable dt = new ZLXIBAL().Select1128(pId); string aaaa = dt.Rows[0][0].ToString(); aaaa = aaaa.Replace("\\", "\\\\"); // mImagePath = mRunPath + a + "\\"; mImagePath = aaaa + "\\" + dangId; // string[] files = Directory.GetFiles((System.IO.Directory.GetCurrentDirectory() + "\\" + dangId + "")); string[] files = Directory.GetFiles((mImagePath + "")); filescpoy = files; cnt111 = files.Length; for (int i = 0; i < files.Length; i++) { if (files[i].EndsWith(".png", true, null) || files[i].EndsWith(".bmp", true, null) || files[i].EndsWith(".jpg", true, null) || files[i].EndsWith(".gif", true, null)) { lstImgPath.Add(files[i]); } } string[] options = new string[lstImgPath.Count]; for (int i = 0; i < lstImgPath.Count; i++) { options[i] = lstImgPath[i]; } // options[0] = "C:\\Users\\jnu\\pictures\\微信图片_20181017171157.jpg"; // options[1] = "C:\\Users\\jnu\\pictures\\微信图片_20181017171157.jpg"; RUN(options); } }
private void btn_scwj_Click_1(object sender, EventArgs e) { int[] a = new int[10000]; for (int i = 0; i < 9999; i++) { a[i] = 0; } int j = 0; bool flag1 = false; DialogResult button = MessageBox.Show("确定要删除本条信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (button == DialogResult.Yes) { flag1 = true; } if (flag1 == true) { int count = dataGridView3.Rows.Count; for (int i = 0; i < count - 1; i++) { if (Convert.ToBoolean(dataGridView3.Rows[i].Cells[0].Value) == true) { a[j++] = i; if (button == DialogResult.Yes) { // MessageBox.Show(e.RowIndex.ToString()); string dId = dataGridView3.Rows[i].Cells["档号3"].Value.ToString(); DataTable dt = new ZLBAL().Select115(lzId, "19", dId); string bh2 = dt.Rows[0][0].ToString(); bool f = new ZLBAL().Update112("0", lzId, bh2); // dataGridView3.Rows.RemoveAt(dataGridView3.CurrentCell.RowIndex); bool flag = new ZLXIBAL().Delete4(dId); } cc3 = 0; } } int s = 0; while (a[s] >= 0) { dataGridView3.Rows.RemoveAt(a[s]); for (int i = s + 1; i < 9999; i++) { a[i] = a[i] - 1; } s++; } copylw = lw; lw = dataGridView3.Rows.Count - 1; } }
private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView3.Columns[e.ColumnIndex].Name == "btnsc" && e.RowIndex >= 0) { DialogResult button = MessageBox.Show("确定要删除本条信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (button == DialogResult.Yes) { // MessageBox.Show(e.RowIndex.ToString()); string dId = dataGridView3.Rows[e.RowIndex].Cells["档号3"].Value.ToString(); DataTable dt = new ZLBAL().Select115(lzId, "19", dId); string bh2 = dt.Rows[0][0].ToString(); bool f = new ZLBAL().Update112("0", lzId, bh2); dataGridView3.Rows.RemoveAt(dataGridView3.CurrentCell.RowIndex); bool flag = new ZLXIBAL().Delete4(dId); } } }
private void dataGridView3_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { try { dId = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString();//获取档号 DataTable dt11 = new ZLXIBAL().Select9(dId); xmh3 = dt11.Rows[0][0].ToString(); DataTable dt1 = new ZLBAL().Select7(xmh3, "19", dId); parentId22 = dt1.Rows[0][0].ToString();//获取parentId2 string strcolumn = this.dataGridView3.Columns[this.dataGridView3.CurrentCell.ColumnIndex].HeaderText; // MessageBox.Show(strcolumn); DataTable dt = new ZLBAL().Select6(strcolumn); wid = dt.Rows[0][0].ToString(); Org3 = dataGridView3.CurrentCell.Value.ToString(); // MessageBox.Show(Org2); } catch { } try { if (this.dataGridView3.CurrentCell.ColumnIndex.ToString() == "7")//在此指定和哪一列绑定 { System.Drawing.Rectangle rect = dataGridView3.GetCellDisplayRectangle(dataGridView3.CurrentCell.ColumnIndex, dataGridView3.CurrentCell.RowIndex, false); dtp3.Left = rect.Left; dtp3.Top = rect.Top; dtp3.Width = rect.Width; dtp3.Height = rect.Height; dtp3.Visible = true; // i = this.dataGridView1.CurrentRow.Index; // j = this.dataGridView1.CurrentCell.ColumnIndex; dataGridView3.CurrentCell.Value = dtp3.Value; } else { dtp3.Visible = false; } } catch { } }
private void AddFolderImages() { string mImagePath = ""; index = -1; lstImgPath = new List <string>(); #region 加载所有图片 //获取该目录下所有图片 DataTable dt = new ZLXIBAL().Select1128(pId); string aaaa = dt.Rows[0][0].ToString(); aaaa = aaaa.Replace("\\", "\\\\"); // mImagePath = mRunPath + a + "\\"; mImagePath = aaaa + "\\" + dangId; // string[] files = Directory.GetFiles((System.IO.Directory.GetCurrentDirectory() + "\\" + dangId + "")); string[] files = Directory.GetFiles((mImagePath + "")); filescpoy = files; cnt111 = files.Length; for (int i = 0; i < files.Length; i++) { if (files[i].EndsWith(".png", true, null) || files[i].EndsWith(".bmp", true, null) || files[i].EndsWith(".jpg", true, null) || files[i].EndsWith(".gif", true, null)) { lstImgPath.Add(files[i]); } } #endregion //ToolTip toolTip = null; //toolTip = new ToolTip(); //toolTip.AutomaticDelay = 100; //toolTip.AutoPopDelay = 10000; //to+olTip.InitialDelay = 100; //toolTip.ReshowDelay = 100; pnlImage.Controls.Clear(); Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback); StringBuilder sb = new StringBuilder(); for (int i = 0; i < lstImgPath.Count; i++) { try { Panel pnl = new Panel(); pnl.Size = new Size(pnlImage.Height, pnlImage.Height); pnl.BackgroundImageLayout = ImageLayout.Zoom; pnl.Tag = i; pnl.Padding = new System.Windows.Forms.Padding(3); pnl.Dock = DockStyle.Left; PictureBox pic = new PictureBox(); pic.SizeMode = PictureBoxSizeMode.Zoom; pic.Dock = DockStyle.Fill; //pic.Click += pic_Click; pic.MouseUp += Mouse_Click; pnl.Controls.Add(pic); pic.Image = Image.FromFile(lstImgPath[i]);//img.GetThumbnailImage(32, 32, pnlImage.Controls.Add(pnl); //toolTip.SetToolTip(pic, lstImgPath[i]); //Application.DoEvents(); } catch (Exception ex)// { sb.AppendLine(lstImgPath[i] + ex.Message); } } if (sb.ToString().Length > 0) { MessageBox.Show(sb.ToString()); } }
private void Form图处管理_Load(object sender, EventArgs e) { DataTable dt11 = new ZLXIBAL().Select7(lzId); pId = dt11.Rows[0][0].ToString(); DataTable dt = new ZLXIBAL().Select3(lzId); gdmethod = dt.Rows[0][0].ToString(); if (gdmethod == "项目") { DataTable dt3 = new ZLXIBAL().Select2(pId, lzId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select1(); int i = 0; int cnt = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } for (int ss = 0; ss < dt3.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt; w++) { dr[dt2.Rows[w][0].ToString()] = dt3.Rows[ss][0].ToString(); ss++; } ll++; dt1.Rows.Add(dr); } dataGridView1.DataSource = dt1; } else if (gdmethod == "案卷") { dataGridView1.ReadOnly = true; DataTable dt12 = new ZLBAL().Select112(pId, lzId); DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } for (int ss = 0; ss < dt12.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt12.Rows[ss][1].ToString(); ss++; } ll++; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } else { dataGridView1.ReadOnly = true; dataGridView2.ReadOnly = true; DataTable dt22 = new ZLBAL().Select1113(pId, lzId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt22.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt22.Rows[ss][1].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); btn.Name = "btnck"; btn.HeaderText = "查看"; btn.DefaultCellStyle.NullValue = "查看"; dataGridView3.Columns.Add(btn); DataGridViewButtonColumn btn2 = new DataGridViewButtonColumn(); btn2.Name = "btntc"; btn2.HeaderText = "图处"; btn2.DefaultCellStyle.NullValue = "图处"; dataGridView3.Columns.Add(btn2); } }
private void btn_next_Click(object sender, EventArgs e) { cc3 = 0; string str99 = ""; int count = dataGridView2.Rows.Count; for (int n = 0; n < count; n++) { if ((bool)dataGridView2.Rows[n].Cells[0].EditedFormattedValue == true) { str99 = dataGridView2.Rows[n].Cells["案卷题名"].Value.ToString(); anId = dataGridView2.Rows[n].Cells["案卷号"].Value.ToString(); DataTable dt22 = new ZLXIBAL().Select8(pId, str99); if (dt22 == null || dt22.Rows.Count == 0) { int cnt3 = 0; DataTable dt = new DataTable(); DataTable dt11 = new AABAL().Select7(pId); int k = 0; while (k < dt11.Rows.Count) { dt.Columns.Add(dt11.Rows[k][0].ToString(), typeof(string)); cnt3++; k++; } copy3 = cnt3; dataGridView3.DataSource = dt; copylw = lw; } else { DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt22.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt22.Rows[ss][0].ToString(); ss++; } lw++; copylw = lw; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } } } DataTable fff = new AABAL().Select7777(pId, str99); s11 = fff.Rows[0][0].ToString(); }
private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridView2.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString() == "True") { int st = e.RowIndex; for (int i = 0; i < dataGridView2.RowCount - 1; i++) { if (i != st) { dataGridView2.Rows[i].Cells[0].Value = false; } } } int count = dataGridView2.Rows.Count; for (int i = 0; i < count; i++) { if ((bool)dataGridView2.Rows[i].Cells[0].EditedFormattedValue == true) { DataTable dt11 = new ZLXIBAL().Select7(lzId); //string xmh = dt11.Rows[0][0].ToString(); ajname = dataGridView2.Rows[i].Cells["案卷题名"].Value.ToString(); DataTable dt = new ZLXIBAL().Select8(pId, ajname); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.AllowUserToAddRows = false; while (this.dataGridView3.Rows.Count != 0) { this.dataGridView3.Rows.RemoveAt(0); } dataGridView3.DataSource = dt1; } } if (n == 0) { DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); btn.Name = "btnck"; btn.HeaderText = "查看"; btn.DefaultCellStyle.NullValue = "查看"; dataGridView3.Columns.Add(btn); DataGridViewButtonColumn btn2 = new DataGridViewButtonColumn(); btn2.Name = "btntc"; btn2.HeaderText = "图处"; btn2.DefaultCellStyle.NullValue = "图处"; dataGridView3.Columns.Add(btn2); n++; } }
string xmname = "";//获取选中的改行的项目题名 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridView1.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString() == "True") { int st = e.RowIndex; for (int i = 0; i < dataGridView1.RowCount - 1; i++) { if (i != st) { dataGridView1.Rows[i].Cells[0].Value = false; } } } int count = dataGridView1.Rows.Count; for (int j = 0; j < count; j++) { if ((bool)dataGridView1.Rows[j].Cells[0].EditedFormattedValue == true) { //string xmh = dataGridView1.Rows[j].Cells[1].Value.ToString(); xmname = dataGridView1.Rows[j].Cells["项目题名"].Value.ToString(); // DataTable dt5 = new ZLXIBAL().Select4(pId); DataTable dt5 = new ZLXIBAL().Select99(pId, xmname); DataTable dt6 = new DataTable(); DataTable dt7 = new ZLXIBAL().Select5(pId); int k = 0; int cnt2 = 0; while (k < dt7.Rows.Count) { dt6.Columns.Add(dt7.Rows[k][0].ToString(), typeof(string)); cnt2++; k++; } for (int ss = 0; ss < dt5.Rows.Count;) { DataRow dr = dt6.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt7.Rows[w][0].ToString()] = dt5.Rows[ss][0].ToString(); ss++; } la++; dt6.Rows.Add(dr); } dataGridView2.AllowUserToAddRows = false; while (this.dataGridView2.Rows.Count != 0) { this.dataGridView2.Rows.RemoveAt(0); } dataGridView2.DataSource = dt6; } } if (top1 == 0) { } }
private void btn_wj_select_Click(object sender, EventArgs e) { string wjId = textBox7.Text.Trim(); string wjId2 = textBox8.Text.Trim(); string dangId = textBox9.Text.Trim(); DataTable dtt = (DataTable)dataGridView3.DataSource; dtt.Rows.Clear(); dataGridView3.DataSource = dtt; if (gdmethod == "项目" || gdmethod == "案卷") { if (wjId != "" && wjId2 == "") { DataTable dt = new ZLBAL().Select16(ajname, "12", pId, bh, wjId, "20"); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); } else if (wjId == "" && wjId2 != "") { DataTable dt = new ZLBAL().Select17(ajname, "12", pId, bh, wjId2, "20"); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } else if (wjId != "" && wjId2 != "") { DataTable dt = new ZLBAL().Select15(ajname, "12", pId, bh, wjId, wjId2, "20"); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } } else { if (wjId != "" && wjId2 == "") { DataTable dt = new ZLBAL().Select10("20", wjId, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); } else if (wjId == "" && wjId2 != "") { DataTable dt = new ZLBAL().Select11("20", wjId2, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } else if (wjId != "" && wjId2 != "") { DataTable dt = new ZLBAL().Select9("20", wjId, wjId2, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } } if (dangId != "") { DataTable tt = new ZLBAL().Select14(dangId, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < tt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = tt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } }
private void btn_xm_select_Click(object sender, EventArgs e) { string xmh1 = textBox1.Text.Trim(); string xmh22 = textBox2.Text.Trim(); string dangId = textBox3.Text.Trim(); DataTable dtt = (DataTable)dataGridView1.DataSource; dtt.Rows.Clear(); dataGridView1.DataSource = dtt; MessageBox.Show(dangId); if (xmh1 != "" && xmh22 == "") { DataTable dt = new ZLBAL().Select10("1", xmh1, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select1(); int i = 0; int cnt = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt1.Rows.Add(dr); } dataGridView1.DataSource = dt1; } else if (xmh1 == "" && xmh22 != "") { DataTable dt = new ZLBAL().Select11("1", xmh22, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select1(); int i = 0; int cnt = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt1.Rows.Add(dr); } } else if (xmh1 != "" && xmh22 != "") { DataTable dt = new ZLBAL().Select9("1", xmh1, xmh22, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select1(); int i = 0; int cnt = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } ll++; dt1.Rows.Add(dr); } dataGridView1.DataSource = dt1; } if (dangId != "") { DataTable tt = new ZLBAL().Select12(dangId, pId); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select1(); int i = 0; int cnt = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } for (int ss = 0; ss < tt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt; w++) { dr[dt2.Rows[w][0].ToString()] = tt.Rows[ss][0].ToString(); ss++; } ll++; dt1.Rows.Add(dr); } dataGridView1.DataSource = dt1; } }
private void Form著录3_Load(object sender, EventArgs e) { dtp1.Value = System.DateTime.Now; this.dataGridView1.Controls.Add(dtp1); dtp1.Visible = false; dtp2.Value = System.DateTime.Now; this.dataGridView2.Controls.Add(dtp2); dtp2.Visible = false; dtp3.Value = System.DateTime.Now; this.dataGridView3.Controls.Add(dtp3); dtp3.Visible = false; DataTable dt11 = new ZLXIBAL().Select7(lzId); pId = dt11.Rows[0][0].ToString(); DataTable dt = new ZLBAL().Select(pId); gdmethod = dt.Rows[0][0].ToString(); if (gdmethod == "项目") { DataTable dt3 = new ZLBAL().Select2(pId, lzId); if (dt3 == null || dt3.Rows.Count == 0) { int cnt = 0; DataTable dt1 = new DataTable(); DataTable dt2 = new ZLBAL().Select1(pId); int i = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } copy = cnt; DataRow dr = dt1.NewRow(); dt1.Rows.Add(dr); dataGridView1.DataSource = dt1; copylx = lx; } else { int cnt = 0; parentId = dt3.Rows[1][0].ToString(); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLBAL().Select1(pId); int i = 0; while (i < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[i][0].ToString(), typeof(string)); cnt++; i++; } copy = cnt; //cnt是列数 // MessageBox.Show(copy.ToString()); for (int ss = 0; ss < dt3.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int m = 0; m < cnt; m++) { dr[dt2.Rows[m][0].ToString()] = dt3.Rows[ss][1].ToString(); ss++; } lx++; copylx = lx; dt1.Rows.Add(dr); } dataGridView1.DataSource = dt1; } } else if (gdmethod == "案卷") { dataGridView1.ReadOnly = true; DataTable dt12 = new ZLBAL().Select112(pId, lzId);//找sx if (dt12 == null || dt12.Rows.Count == 0) { DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } copy2 = cnt2; dataGridView2.DataSource = dt111; copyll = ll; } else { DataTable dt111 = new DataTable(); DataTable dt5 = new AABAL().Select6(pId); int m = 0; int cnt2 = 0; while (m < dt5.Rows.Count) { dt111.Columns.Add(dt5.Rows[m][0].ToString(), typeof(string)); cnt2++; m++; } copy2 = cnt2; for (int ss = 0; ss < dt12.Rows.Count;) { DataRow dr = dt111.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt5.Rows[w][0].ToString()] = dt12.Rows[ss][1].ToString(); ss++; } ll++; copyll = ll; dt111.Rows.Add(dr); } dataGridView2.DataSource = dt111; } } else { dataGridView1.ReadOnly = true; dataGridView2.ReadOnly = true; DataTable dt13 = new ZLBAL().Select113(pId, lzId);//找sx if (dt13 == null || dt13.Rows.Count == 0) { int cnt3 = 0; DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } copy3 = cnt3; dataGridView3.DataSource = dt1; copylw = lw; } else { DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } copy3 = cnt3; for (int ss = 0; ss < dt13.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt13.Rows[ss][1].ToString(); ss++; } lw++; copylw = lw; dt1.Rows.Add(dr); } dataGridView3.DataSource = dt1; } } }
private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridView2.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString() == "True") { int st = e.RowIndex; for (int i = 0; i < dataGridView2.RowCount - 1; i++) { if (i != st) { dataGridView2.Rows[i].Cells[0].Value = false; } } } if (dataGridView2.Columns[e.ColumnIndex].Name == "btnsc" && e.RowIndex >= 0) { DialogResult button = MessageBox.Show("确定要删除本条信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (button == DialogResult.Yes) { string aname = dataGridView2.Rows[e.RowIndex].Cells["案卷题名"].Value.ToString(); string aId = dataGridView2.Rows[e.RowIndex].Cells["案卷号"].Value.ToString(); DataTable dt = new ZLBAL().Select115(lzId, "11", aId); string bh2 = dt.Rows[0][0].ToString(); bool f = new ZLBAL().Update112("0", lzId, bh2); bool flag = new ZLXIBAL().Delete2("12", aname, pId, bh); bool flag2 = new ZLXIBAL().Delete3("12", aname, pId, bh); dataGridView2.Rows.RemoveAt(dataGridView2.CurrentCell.RowIndex); if (dataGridView3.Rows.Count != 0) { DataTable tt = (DataTable)dataGridView3.DataSource; tt.Rows.Clear(); dataGridView3.DataSource = tt; } } } int count = dataGridView2.Rows.Count; for (int i = 0; i < count; i++) { if ((bool)dataGridView2.Rows[i].Cells[0].EditedFormattedValue == true) { DataTable dt11 = new ZLXIBAL().Select7(lzId); //string xmh = dt11.Rows[0][0].ToString(); ajname = dataGridView2.Rows[i].Cells["案卷题名"].Value.ToString(); DataTable dt = new ZLXIBAL().Select8(pId, ajname); DataTable dt1 = new DataTable(); DataTable dt2 = new ZLXIBAL().Select6(pId); int j = 0; int cnt3 = 0; while (j < dt2.Rows.Count) { dt1.Columns.Add(dt2.Rows[j][0].ToString(), typeof(string)); cnt3++; j++; } for (int ss = 0; ss < dt.Rows.Count;) { DataRow dr = dt1.NewRow(); for (int w = 0; w < cnt3; w++) { dr[dt2.Rows[w][0].ToString()] = dt.Rows[ss][0].ToString(); ss++; } lw++; dt1.Rows.Add(dr); } dataGridView3.AllowUserToAddRows = false; while (this.dataGridView3.Rows.Count != 0) { this.dataGridView3.Rows.RemoveAt(0); } dataGridView3.DataSource = dt1; } } if (n == 0) { DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); btn.Name = "btnsc"; btn.HeaderText = "删除"; btn.DefaultCellStyle.NullValue = "删除"; dataGridView3.Columns.Add(btn); n++; } }
string xmname = "";//获取选中的改行的项目题名 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridView1.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString() == "True") { int st = e.RowIndex; for (int i = 0; i < dataGridView1.RowCount - 1; i++) { if (i != st) { dataGridView1.Rows[i].Cells[0].Value = false; } } } if (dataGridView1.Columns[e.ColumnIndex].Name == "btnsc" && e.RowIndex >= 0) { DialogResult button = MessageBox.Show("确定要删除本条信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (button == DialogResult.Yes) { string xmname = dataGridView1.Rows[e.RowIndex].Cells["项目题名"].Value.ToString(); string xId = dataGridView1.Rows[e.RowIndex].Cells["项目号"].Value.ToString(); DataTable dt = new ZLBAL().Select115(lzId, "1", xId); string bh2 = dt.Rows[0][0].ToString(); bool f = new ZLBAL().Update112("0", lzId, bh2); bool flag = new ZLXIBAL().Delete(xmname, pId, bh); //删文件 bool flag2 = new ZLXIBAL().Delete2("3", xmname, pId, bh); //删案 卷 bool flag3 = new ZLXIBAL().Delete3("3", xmname, pId, bh); //删项目 dataGridView1.Rows.RemoveAt(dataGridView1.CurrentCell.RowIndex); if (dataGridView2.Rows.Count != 0) { DataTable dtt = (DataTable)dataGridView2.DataSource; dtt.Rows.Clear(); dataGridView2.DataSource = dtt; } if (dataGridView3.Rows.Count != 0) { DataTable tt = (DataTable)dataGridView3.DataSource; tt.Rows.Clear(); dataGridView3.DataSource = tt; } } } int count = dataGridView1.Rows.Count; for (int j = 0; j < count; j++) { if ((bool)dataGridView1.Rows[j].Cells[0].EditedFormattedValue == true) { //string xmh = dataGridView1.Rows[j].Cells[1].Value.ToString(); xmname = dataGridView1.Rows[j].Cells["项目题名"].Value.ToString(); // DataTable dt5 = new ZLXIBAL().Select4(pId); DataTable dt5 = new ZLXIBAL().Select99(pId, xmname); DataTable dt6 = new DataTable(); DataTable dt7 = new ZLXIBAL().Select5(pId); int k = 0; int cnt2 = 0; while (k < dt7.Rows.Count) { dt6.Columns.Add(dt7.Rows[k][0].ToString(), typeof(string)); cnt2++; k++; } for (int ss = 0; ss < dt5.Rows.Count;) { DataRow dr = dt6.NewRow(); for (int w = 0; w < cnt2; w++) { dr[dt7.Rows[w][0].ToString()] = dt5.Rows[ss][0].ToString(); ss++; } la++; dt6.Rows.Add(dr); } dataGridView2.AllowUserToAddRows = false; while (this.dataGridView2.Rows.Count != 0) { this.dataGridView2.Rows.RemoveAt(0); } dataGridView2.DataSource = dt6; } } if (top1 == 0) { DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); btn.Name = "btnsc"; btn.HeaderText = "删除"; btn.DefaultCellStyle.NullValue = "删除"; dataGridView2.Columns.Add(btn); top1++; } }
private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView3.Columns[e.ColumnIndex].Name == "btnsm" && e.RowIndex >= 0) { /* string str1 = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString(); * string str2 = dataGridView3.Rows[e.RowIndex].Cells[2].Value.ToString(); * string str3 = dataGridView3.Rows[e.RowIndex].Cells[3].Value.ToString(); * string str4 = dataGridView3.Rows[e.RowIndex].Cells[4].Value.ToString(); * string str5 = dataGridView3.Rows[e.RowIndex].Cells[5].Value.ToString(); * Form扫描 form = new Form扫描(str1, str2, str3, str4, str5); * this.Hide(); * form.ShowDialog(); * this.Close();*/ a = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString(); mRunPath = System.IO.Directory.GetCurrentDirectory() + "\\"; // mImagePath = mRunPath + "Image\\"; mImagePath = mRunPath + a + "\\"; if (Directory.Exists(mImagePath) == false) { Directory.CreateDirectory(mImagePath); } mTwain.Language = TwLanguage.CHINESE_SINGAPORE; if (cnm == 0) { mTwain.IsTwain2Enable = false; mTwain.OpenDSM(); cnm = 1; } List <string> srclst = new List <string>(); for (int i = 0; i < mTwain.SourcesCount; i++) { srclst.Add(mTwain.GetSourceProductName(i)); } combo_Dev.DataSource = srclst; mTwain.EndXfer += twEndXfer; float val = 150; mTwain.Capabilities.XResolution.Set(val); mTwain.Capabilities.YResolution.Set(val); mTwain.Capabilities.PixelType.Set(TwPixelType.BW); mTwain.ShowUI = true; mTwain.Acquire(); } else if (dataGridView3.Columns[e.ColumnIndex].Name == "btnck" && e.RowIndex >= 0) { string str1 = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString(); Form3 form = new Form3(str1, pId); form.ShowDialog(); } else if (dataGridView3.Columns[e.ColumnIndex].Name == "btnqk" && e.RowIndex >= 0) { if (MessageBox.Show("您要删除之前的扫描文件吗?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { #region 初始化删除所有文件 DirectoryInfo dir = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\" + dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString() + "\\"); FileInfo[] inf = dir.GetFiles(); foreach (FileInfo finf in inf) { finf.Delete(); } #endregion } } else if (dataGridView3.Columns[e.ColumnIndex].Name == "btntc" && e.RowIndex >= 0) { /* p = new Process(); * //需要启动的程序 * p.StartInfo.FileName = @"D:\scan\NAPS2\NAPS2.exe"; * //为了美观,启动的时候最小化程序 * // p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; * //启动 * p.Start(); * * //这里必须等待,否则启动程序的句柄还没有创建,不能控制程序 * /* Thread.Sleep(10000); * //最大化启动的程序 * ShowWindow(p.MainWindowHandle, (short)ShowWindowStyles.SW_MAXIMIZE); * //设置被绑架程序的父窗口 * SetParent(p.MainWindowHandle, this.Handle); * //改变尺寸 * ResizeControl();*/ string dangId = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString(); string mImagePath = ""; index1 = -1; lstImgPath = new List <string>(); DataTable dt = new ZLXIBAL().Select1128(pId); string aaaa = dt.Rows[0][0].ToString(); aaaa = aaaa.Replace("\\", "\\\\"); // mImagePath = mRunPath + a + "\\"; mImagePath = aaaa + "\\" + dangId; // string[] files = Directory.GetFiles((System.IO.Directory.GetCurrentDirectory() + "\\" + dangId + "")); string[] files = Directory.GetFiles((mImagePath + "")); filescpoy1 = files; cnt111 = files.Length; for (int i = 0; i < files.Length; i++) { if (files[i].EndsWith(".png", true, null) || files[i].EndsWith(".bmp", true, null) || files[i].EndsWith(".jpg", true, null) || files[i].EndsWith(".gif", true, null)) { lstImgPath.Add(files[i]); } } string[] options = new string[lstImgPath.Count]; for (int i = 0; i < lstImgPath.Count; i++) { options[i] = lstImgPath[i]; } // options[0] = "C:\\Users\\jnu\\pictures\\微信图片_20181017171157.jpg"; // options[1] = "C:\\Users\\jnu\\pictures\\微信图片_20181017171157.jpg"; RUN(options); } }