private void select_zhi(string tzid) { sql_sel s1 = new sql_sel(); string[] zhi1 = s1.select_dataread_only_zu_where("B台账", "*", "R序号", tzid); ArrayList imglist = s1.select_array_byte_little("B图片", "R图片", "R所属台账序号", tzid); longbotu1.arry = imglist; longbotu1.leixin = s1.select_dataread_all_zu_where("B图片", "R图片类型", "R所属台账序号", tzid); longbotu1.load(); try { byte[] syt_bytes = (byte[])s1.select_only("B示意图", "R示意图", "R所属台账编号", tzid); string_to_img sti1 = new string_to_img(); img_width_change iwc1 = new img_width_change(); pictureBox1.Image = iwc1.change(sti1.byte_img(syt_bytes, "jpg"), pictureBox1.Width, pictureBox1.Height); } catch { Graphics g1 = Graphics.FromImage(pictureBox1.Image); g1.FillRectangle(Brushes.White, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); //涂成白色 Font font = new Font("黑体", 20, FontStyle.Bold); Brush sb1 = new SolidBrush(Color.Yellow); g1.DrawString("这个台账没有示意图!", font, sb1, 20, 20); pictureBox1.Image = pictureBox1.Image; } wenzi_fuzhi(zhi1); Text = "远望谷—铁路车号识别—台账详情:" + ID1 + "。" + username + ",欢迎您!"; whjlb(ID1); }
public void load() { Bitmap b1 = new Bitmap(pictureBox1.Width, pictureBox1.Height); //新建位图b1 Graphics g2 = Graphics.FromImage(b1); //创建b1的Graphics g2.FillRectangle(Brushes.White, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); //把b1涂成白色 pictureBox1.Image = b1; noimg(); img = new Image[arry.Count]; if (arry.Count == 0) { noimg(); } else { string_to_img strt1 = new string_to_img(); img_width_change imgc1 = new img_width_change(); for (int j = 0; j < arry.Count; j++) { img[j] = strt1.byte_img((byte[])arry[j], leixin[j]); img[j] = imgc1.change(img[j], pictureBox1.Width, pictureBox1.Height); } i = 0; pictureBox1.Image = img[i]; } Button_load(); }
private void button3_Click(object sender, EventArgs e) { sql_sel s1 = new sql_sel(); s1.conn(); string sql = "select R示意图 From dbo.B示意图 where R所属台账编号='" + textBox1.Text + "'"; byte[] b = (byte[])s1.select(sql); MemoryStream ms = new MemoryStream(b); Image image = System.Drawing.Image.FromStream(ms); img_width_change a = new img_width_change(); image = a.change(image, pictureBox2.Width, pictureBox2.Height); pictureBox2.Image = image; s1.close(); }
private void from_file_Click(object sender, EventArgs e) { OpenFileDialog fdl1 = new OpenFileDialog(); fdl1.Title = "选择图片"; fdl1.Filter = "图像文件(*.jpeg/jpg;*.bmp;*.png;*.gif)|*.jpeg;*.jpg;*.bmp;*.png;*.gif"; fdl1.InitialDirectory = "D:\\"; fdl1.Multiselect = false; fdl1.ShowDialog(); Image imgs = Image.FromFile(fdl1.FileName); img_width_change a = new img_width_change(); imgs = a.change(imgs, pictureBox1.Width, pictureBox1.Height); pictureBox1.Image = imgs; byte1 = File.ReadAllBytes(@fdl1.FileName); }
public void shuju() { if (ID != null & ID != "") { string[] read; sql_sel s1 = new sql_sel(); string r1 = "R名称,R型号,R序列号,RAEI编号,R射频缆长度,RIP地址,R联系人,R联系电话,R安装人员,R安装时间,RRadmin账号,RRadmin密码"; read = s1.select_dataread_only_zu_where("B台账", r1, "R序号", ID.ToString()); name.Text = read[0]; xinghao.Text = read[1]; sn.Text = read[2]; aei.Text = read[3]; shepinglan.Text = read[4]; ip.Text = read[5]; kehuname.Text = read[6]; phone.Text = read[7]; anzhuangren.Text = read[8]; DateTime date = new DateTime(); date = Convert.ToDateTime(read[9]); shijian.Text = date.ToShortDateString(); radmin.Text = read[10]; radminpw.Text = read[11]; string_to_img s_t1 = new string_to_img(); img_width_change ac = new img_width_change(); try { Image image = Image.FromStream(new MemoryStream((byte[])s1.select_only("B示意图", "R示意图", "R所属台账编号", ID.ToString()))); pictureBox1.Image = ac.change(image, pictureBox1.Width, pictureBox1.Height); } catch { Graphics g1 = Graphics.FromImage(pictureBox1.Image); g1.FillRectangle(Brushes.White, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); //涂成白色 Font font = new Font("黑体", 20, FontStyle.Bold); Brush sb1 = new SolidBrush(Color.Yellow); g1.DrawString("这个台账没有示意图!", font, sb1, 20, 20); pictureBox1.Image = pictureBox1.Image; } } else { clear(); } }
private void shiyitu_Load(object sender, EventArgs e) { AcceptButton = save_img; Text = "远望谷—铁路车号识别—台账示意图。" + username + ",欢迎您!"; this.Size = new Size(1390, 668); font = new Font("黑体", 20, FontStyle.Bold); pen1 = new Pen(Color.Black); Sb1 = new SolidBrush(Color.Black); int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; foreach (int i in a) { pen_width.Items.Add(i.ToString()); } string[] b = { "1#", "2#", "3#", "4#", "接线盒", "磁钢", "上行", "下行" }; text.Items.AddRange(b); pictureBox1.BorderStyle = BorderStyle.Fixed3D; shibie = "Line"; pictureBox1.Image = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); sql_sel s1 = new sql_sel(); try { byte[] syt_bytes = (byte[])s1.select_only("B示意图", "R示意图", "R所属台账编号", tzid); string_to_img sti1 = new string_to_img(); img_width_change iwc1 = new img_width_change(); pictureBox1.Image = iwc1.change(sti1.byte_img(syt_bytes, "jpg"), pictureBox1.Width, pictureBox1.Height); } catch { /* * Graphics g1 = Graphics.FromImage(pictureBox1.Image); * g1.FillRectangle(Brushes.White, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); //涂成白色 * Font font = new Font("黑体", 20, FontStyle.Bold); * Brush sb1 = new SolidBrush(Color.Yellow); * g1.DrawString("这个台账没有示意图!", font, sb1, 20, 20); * pictureBox1.Image = pictureBox1.Image; */ clear(); } }