Is it possible to drag and drop into a ultra status bar? The idea is that the status bar has buttons on which the user should be able to drop. Each button has its on logic for what kind of drop it accepts and the drag drop indicator should change accordingly as the user drags over the status bar.
Hello,
I've pasted below a code snippet of the DragOver event handler for the UltraStatusBar:
private void ultraStatusBar1_DragOver(object sender, DragEventArgs e){ foreach (UltraStatusPanel panel in ultraStatusBar1.Panels) { Rectangle rect = panel.UIElement.Rect; Point p = ultraStatusBar1.PointToClient(new Point(e.X, e.Y)); if (p.X > rect.X && p.X < rect.X + rect.Width) { panel.Text = "Drop!"; } else { panel.Text = string.Empty; } }}
This checks the x coordinate of the mouse pointer, converts it to client space, then looks at each panel's UIElement to see where the user dropped the data.
Please let me know if you have any further questions.
Thank you, this worked.
I optimized it a bit by looking only at the buttons (panels) I'm interested in instead of looping through all panels. You can also esily test if a point is inside a rectangle using :
rect.Contains(pnt)