private void Form1_LocationChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { if (frm2 != null) { frm2.Close(); } frm2 = new Frm_Browser(); string path = listView1.SelectedItems[0].SubItems[1].Text; int x = this.Location.X; int y = this.Location.Y; frm2.x = x + this.Width; frm2.y = y; frm2.pictureBox1.Image = Image.FromFile(path); frm2.Show(); this.Focus(); } else { if (frm2 != null) { frm2.Close(); } frm2 = new Frm_Browser(); int x = this.Location.X; int y = this.Location.Y; frm2.x = x + this.Width; frm2.y = y; frm2.Hide(); this.Focus(); } }
private void Form1_Load(object sender, EventArgs e) { int x = this.Location.X; int y = this.Location.Y; frm2 = new Frm_Browser(); frm2.x = x + this.Width; frm2.y = y; frm2.Hide(); openFileDialog1.Filter = "支持的图片格式|*.jpeg;*.png;*.bmp;*.jpg"; }