public void AddPicture(Bitmap bm) { int width, height; height = panel1.Height - 10; width = Convert.ToInt32(((float)bm.Width / (float)bm.Height) * height); UCPictureBoxClass pb = new UCPictureBoxClass(); pb.Name = "Neal"; pb.Size = new Size(width, height); pb.Location = new Point(pictureOffSet, 0); pictureOffSet += width; pb.BorderStyle = BorderStyle.FixedSingle; pb.SizeMode = PictureBoxSizeMode.Normal; pb.fullSizedImage = bm; pb.Image = (Image)bm.GetThumbnailImage(width, height, null, IntPtr.Zero); pb.MouseEnter += new System.EventHandler(this.image_MouseEnter); pb.MouseLeave += new System.EventHandler(this.image_MouseLeave); pb.Click += new System.EventHandler(this.image_Click); pb.BorderStyle = BorderStyle.None; this.panel2.Controls.Add(pb); pictureWidth[maxPicture] = width; maxPicture++; if (maxPicture == 1) { panel2.Size = new Size(width, panel2.Height); } else { panel2.Size = new Size(panel2.Width + width, panel2.Height); } }
private void pictureStrip1_Clicked(object sender, EventArgs e) { UCPictureBoxClass pb = (UCPictureBoxClass)sender; imageBox.Image = pb.fullSizedImage; }