Click here to Skip to main content
16,022,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am developing a c# windows application in which i want to drag 4 pictures from 4 buttons into a picturebox. i can drag and drop pictures into a picturebox but my problem is that they all pile in one location. i want them to be arranged either vertically or horizontally. Below is my picturebox dragdrop event method.

Collapse | Copy Code

private void picBox_DragDrop(object sender, DragEventArgs e)
{
PictureBox p1 = (PictureBox)sender;
Graphics g = p1.CreateGraphics();


g.DrawImage((Image)e.Data.GetData(DataFormats.Bitmap), new Point(0, 0));



}
Posted
Comments
Sergey Alexandrovich Kryukov 17-Aug-14 4:34am    
The solution is: don't use PictureBox; this type is not helpful here, will give you much more trouble than help. Instead, create a custom control doing that. It's much, much easier if you get rid of PictireBox; and not really difficult. Use System.Drawing.Graphics.DrawImage. If you have questions, I'll give you more detail.
—SA
[no name] 17-Aug-14 8:16am    
Just reposting your question is not at all helpful. You obviously need to resize the pictures and arrange then in your picturebox.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900