private void newText_Click(object sender, EventArgs e) { AlphaBlendTextBox text = new AlphaBlendTextBox(); text.BorderStyle = BorderStyle.FixedSingle; text.ContextMenu = new ContextMenu(); text.Multiline = true; //panel1.Controls.Add(text); //text.BringToFront(); if (selDPB != null) { selDPB.Controls.Add(text); } else { MessageBox.Show("Выберите Картинку на форме"); } }
private void newText_Click(object sender, EventArgs e) { AlphaBlendTextBox text = new AlphaBlendTextBox(); text.BorderStyle = BorderStyle.FixedSingle; text.ContextMenu = new ContextMenu(); text.Multiline = true; //panel1.Controls.Add(text); //text.BringToFront(); if (selDPB != null) selDPB.Controls.Add(text); else MessageBox.Show("Выберите Картинку на форме"); }
private void browse_Click(object sender, EventArgs e) { pictureBox1.Add(new DragPictureBox()); pictureBox1.Last().Click += new EventHandler(PBFocusEvent); pictureBox1.Last().Name = "dpb" + (pbCnt++).ToString(); pictureBox1.Last().Width = 1242; pictureBox1.Last().Height = 852; DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) // Test result. { string file = openFileDialog1.FileName; if (file.Remove(0, file.Length - 2) == "ac") { ObjSer os = new ObjSer(); pictureBox1.Clear(); Stream TestFileStream = File.OpenRead(file); BinaryFormatter deserializer = new BinaryFormatter(); os = (ObjSer)deserializer.Deserialize(TestFileStream); TestFileStream.Close(); for (int i = 0; i < os.GetPicEnumerator(); i++) { pictureBox1.Add(new DragPictureBox()); pictureBox1.Last().Click += new EventHandler(PBFocusEvent); pictureBox1.Last().Width = os.GetFromPicList(i).Width; pictureBox1.Last().Height = os.GetFromPicList(i).Height; pictureBox1.Last().Location = new Point(os.GetFromPicList(i).X, os.GetFromPicList(i).Y); pictureBox1.Last().Image = StringToImage(os.GetFromPicList(i).PicArray); panel1.Controls.Add(pictureBox1.Last()); pictureBox1.Last().BringToFront(); } for (int i = 0; i < os.GetTextEnumerator(); i++) { AlphaBlendTextBox text = new AlphaBlendTextBox(); text.BorderStyle = BorderStyle.FixedSingle; text.ContextMenu = new ContextMenu(); text.Multiline = true; text.Font = new Font(os.GetFromTextList(i).FontName, os.GetFromTextList(i).FontSize, os.GetFromTextList(i).FontStyle); text.ForeColor = os.GetFromTextList(i).FontColor; text.Location = new Point(os.GetFromTextList(i).X, os.GetFromTextList(i).Y); text.Text = os.GetFromTextList(i).Text; pictureBox1[os.GetFromTextList(i).PicNumber].Controls.Add(text); text.Focus(); text.Select(text.Text.Length, 0); } } else { img = new Bitmap(file); while (img.Height > pictureBox1.Last().Height) { img2 = new Bitmap(img, (int)(img.Width * 0.9), (int)(img.Height * 0.9)); img = img2; } pictureBox1.Last().Image = img; pictureBox1.Last().Width = img.Width; pictureBox1.Last().Height = img.Height; pictureBox1.Last().BackColor = Color.Transparent; panel1.Controls.Add(pictureBox1.Last()); pictureBox1.Last().BringToFront(); } } }