Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Sep 05, 2010 12:44 am Post subject: |
|
|
This is something we could have a look at for the next feature release of Virtual Tree. If you wanted to do something before then it would be possible to create a custom RowWidget (see help on custom widgets) and override the SetDragCursors method which creates the drag cursors. Below is the default code from this method:
Code: | protected virtual void SetDragCursors()
{
if (!DrawingUtilities.LargeCursorsSupported) return;
int height = Math.Min(Bounds.Height * Tree.SelectedRows.Count, MaxDragCursorHeight);
int width = Tree.ClientSize.Width;
using (Bitmap bitmap = new Bitmap(width, height))
{
using (Graphics graphics = Graphics.FromImage(bitmap))
{
PanelWidget panelWidget = Tree.CreatePanelWidget();
panelWidget.Bounds = new Rectangle(0, 0, width, height); ;
panelWidget.Printing = true;
Rectangle bounds = new Rectangle(0, 0, width, Bounds.Height);
foreach (Row row in Tree.SelectedRows)
{
RowWidget widget = Tree.CreateRowWidget(panelWidget, row);
widget.Columns = Tree.Columns.GetVisibleColumns();
widget.MainColumn = MainColumn;
widget.Bounds = bounds;
widget.OnPaint(graphics);
bounds.Y += bounds.Height;
if (bounds.Y > height)
break;
}
}
if (_moveCursor == null)
{
_moveCursor = new Cursor(typeof(VirtualTree), "Cursors.Move.cur");
_copyCursor = new Cursor(typeof(VirtualTree), "Cursors.Copy.cur");
}
WidgetControl.DragMoveCursor =
DrawingUtilities.CreateCursor(bitmap, 0.5F, 0, 0, _moveCursor, 16, 16, WidgetControl.RightToLeft);
WidgetControl.DragCopyCursor =
DrawingUtilities.CreateCursor(bitmap, 0.5F, 0, 0, _copyCursor, 16, 16, WidgetControl.RightToLeft);
WidgetControl.DragNoneCursor =
DrawingUtilities.CreateCursor(bitmap, 0.5F, 10, 10, Cursors.No, 16, 16, WidgetControl.RightToLeft);
}
} |
The DrawingUtilities.CreateCursor method creates a cursor from a cursor and the bitmap image of the row. It takes an offset between the cursor and bitmap. You would need to change this and the hotspot location. _________________ Infralution Support |
|