private void button2_Click(object sender, EventArgs e) { if (flowLayoutPanel1.Controls.Count < 11) { Image img = pictureBox1.Image; img.Tag = buttonPressed; MyPicBox picBx = new MyPicBox(); picBx.idx = flowLayoutPanel1.Controls.Count; picBx.Name = flowLayoutPanel1.Controls.Count.ToString(); picBx.Margin = new Padding(2); picBx.Height = flowLayoutPanel1.Height - 4; picBx.Width = img.Width / img.Height * picBx.Height; picBx.Image = img; picBx.storedImage = img; picBx.SizeMode = PictureBoxSizeMode.Zoom; picBx.MouseEnter += picBx_MouseEnter; picBx.MouseLeave += picBx_MouseLeave; picBx.MouseClick += picBx_MouseClick; picBx.BorderStyle = BorderStyle.FixedSingle; flowLayoutPanel1.Controls.Add(picBx); button1.Visible = true; } else { MessageBox.Show("Max 10 zdjęć. Skasuj zdjęcia aby dodać nowe."); } }
private void picBx_MouseLeave(object sender, EventArgs e) { finalFramePause = false; MyPicBox pb = (MyPicBox)sender; pb.Image = pb.storedImage; }
private void picBx_MouseEnter(object sender, EventArgs e) { finalFramePause = true; MyPicBox pb = (MyPicBox)sender; pb.Image = NgRegistrator.Properties.Resources.delete; pictureBox1.Image = pb.storedImage; }
private void button1_Click(object sender, EventArgs e) { foreach (var pb in flowLayoutPanel1.Controls) { MyPicBox pBox = (MyPicBox)pb; ngPicturesList.Add(pBox.storedImage); } this.DialogResult = DialogResult.OK; }
private void picBx_MouseClick(object sender, MouseEventArgs e) { MyPicBox pb = (MyPicBox)sender; flowLayoutPanel1.Controls.Remove(pb); }
private void InitBoard() { picboard = new MyPicBox[15, 15]; for (int x = 0; x < picboard.GetLength(0); ++x) { for (int y = 0; y < picboard.GetLength(1); ++y) { board[x, y] = 0; picboard[x, y] = new MyPicBox(); picboard[x, y].Image = (Image)(empty.Image).Clone(); picboard[x, y].Location = new System.Drawing.Point(x*32, y*32); this.picboard[x, y].Name = "picboard_" + x + "_" + y; this.picboard[x, y].Size = new System.Drawing.Size(32, 32); this.picboard[x, y].SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.picboard[x, y].TabIndex = 0; picboard[x, y].x = x; picboard[x, y].y = y; panel1.Controls.Add(picboard[x, y]); this.picboard[x, y].Click += new System.EventHandler(this.field_Click); } } }