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 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); }
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(); } }
public void load() { listView1.View = View.LargeIcon; listView1.MultiSelect = false; imageList1.ImageSize = new Size(25, 25); listView1.LargeImageList = imageList1; string_to_img s_ti1 = new string_to_img(); if (samons.Count != 0) { for (int i = 0; i < samons.Count; i++) { imageList1.Images.Add(s_ti1.byte_img((byte[])samons[i], leixin[i])); } } for (int i = 0; i < samons.Count; i++) { string_to_img sti1 = new string_to_img(); array_jian arr_add = new array_jian(); sti1.byte_img((byte[])samons[i], leixin[i]); listView1.Items.Insert(listView1.Items.Count, new ListViewItem(name[i])); listView1.Items[i].ImageIndex = i; } }