Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Drag effect

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
morgenweck



Joined: 09 Jun 2010
Posts: 21

PostPosted: Sat Sep 04, 2010 4:01 am    Post subject: Drag effect Reply with quote

Is it possible when a user drags a row that the highlighted row effect does not start at the cursor and display to the right but rather highlight the row in it's current position even if the cursor is in the middle?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Sep 05, 2010 12:44 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
morgenweck



Joined: 09 Jun 2010
Posts: 21

PostPosted: Sun Sep 05, 2010 1:42 pm    Post subject: Reply with quote

Thanks
I'll work with that
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group