private void panel1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { ColorDialog cd = new ColorDialog(); if (cd.ShowDialog() == DialogResult.OK) { this.panel3.BackColor = cd.Color; } } }
private void panel1_MouseDown(object sender, MouseEventArgs e) { Panel pnl = sender as Panel; if (pnl != null) pnl.DoDragDrop(pnl.BackColor, DragDropEffects.Move); } private void panel2_DragDrop(object sender, DragEventArgs e) { var data = e.Data.GetData(typeof(Color)); if (data != null) ((Panel)sender).BackColor = (Color)data; } private void panel2_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Move; }
if (e.Button != MouseButtons.Right) { Panel pnl = sender as Panel; if (pnl != null) pnl.DoDragDrop(pnl.BackColor, DragDropEffects.Move); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)