Click here to Skip to main content
16,016,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,

private void panel1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
ColorDialog cd = new ColorDialog();
if (cd.ShowDialog() == DialogResult.OK)
{
this.panel1.BackColor = cd.Color;
}
}

private void panel1_MouseDown(object sender, MouseEventArgs e)
{
panel1.DoDragDrop(panel1, DragDropEffects.Copy);
}

private void panel2_DragDrop(object sender, DragEventArgs e)
{
Control ctrl = e.Data.GetData(e.Data.GetFormats()[0]) as Control;
if (ctrl != null)
{
ctrl.Location = this.panel2.PointToClient(new Point(e.X, e.Y));
this.panel2.Controls.Add(ctrl);
}
}

private void panel2_DragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}

plz help me where is my mistake.
i want only panel1 color to on panel2 or simultainesouly.
Posted
Comments
BillWoodruff 24-Sep-14 5:14am    
What exactly do you want to happen in the 'DragDrop event in Panel2 ?

Your code shows you are adding some Control to Panel2's ControlCollection.

If you just want to take the color selected using Panel1 and make that the background color of Panel2, you don't really need to use the more complicated drag-and-drop code; there's a simple way.
cadsolution 25-Sep-14 1:30am    
any body solve this problem please

1 solution

you want to change the color of panel when u drag is it ?
 
Share this answer
 
Comments
cadsolution 24-Sep-14 3:22am    
rightclick on panel1 for color select eg red color i selected.
now i want to panel back colr red drop to on panel2
means panel1 red color should be same on panel2 red color
BillWoodruff 24-Sep-14 5:12am    
Please post questions that ask the OP to clarify their problem as comments on the original question, not as solutions.
cadsolution 24-Sep-14 6:34am    
anybody help me friends

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