public void AddFrame(Bitmap backImage) { if (backImage != null) { Bitmap newBackImage = new Bitmap(backImage); Frame frame = new Frame(); frame.Location = this.CalculateNextLocation(); frame.ContextMenu = this.ContextMenu; int discount = 2 * this.framePadding; if (this.VScroll) { discount += SystemInformation.VerticalScrollBarWidth; } frame.Size = new Size(this.Width - discount, this.frameHeight); this.images.Add(backImage); frame.BackgroundImage = backImage; frame.MouseDoubleClick += new MouseEventHandler(this.Frame_MouseDoubleClick); frame.MouseClick += new MouseEventHandler(this.Frame_MouseClick); frame.MouseDown += new MouseEventHandler(this.Frame_MouseClick); //frame.SizeChanged += new EventHandler(frame_SizeChanged); this.Controls.Add(frame); } }
private void Frame_MouseDoubleClick(object sender, MouseEventArgs e) { this.selectedFrame = (Frame) sender; this.selectedIndex = this.Controls.GetChildIndex(this.selectedFrame, false); }
public void RemoveFrame(Frame frameToRemove) { int index = this.Controls.GetChildIndex(frameToRemove, false); this.RemoveFrameAt(index); }