Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 677657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:03:48+00:00 2026-05-14T01:03:48+00:00

Users drag rows up and down in my DataGridView. I have the dragging logic

  • 0

Users drag rows up and down in my DataGridView. I have the dragging logic down-pat, but I’d like there to be a dark marker indicating where the row will be placed after I let go of the mouse.

Example from Microsoft Access http://img718.imageshack.us/img718/8171/accessdrag.png
Example from Microsoft Access; I want to drag rows instead of columns

Does anyone know how I’d go about doing this? Is this built-in, or would I have to draw my own marker (if so, how do I do that)?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:03:49+00:00Added an answer on May 14, 2026 at 1:03 am

    I did this for a treeview a couple years ago; can’t remember exactly how, but consider using the MouseMove event of the DataGridView.

    While the drag is occurring, your MouseMove handler should:

    • get the relative coordinates of the
      mouse (the MouseEventArgs contains
      the coordinates, but I think they’re screen coordinates, so you can use DataGridView.PointToClient() to convert them to relative)
    • determine which row is at that X
      position (is there a method for this? If not, you can calculate it by adding up the row + row header heights, but remember that the grid may have been scrolled)
    • highlight that row or darken its
      border. One way you may be able to darken one border is by changing the DataGridViewRow.DividerHeight property.
    • when the mouse moves outside that
      row, restore it to how it previously
      looked.

    If you wanted to do something custom with the appearance of the row under the mouse (instead of just using the available properties), you can use the DataGridView.RowPostPaint event. If you implement a handler for this event which is only used when a row is being dragged over another row, you can repaint the top or bottom border of the row with a bolder brush. MSDN example here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView, where I allow users to Drag/Drop rows to reorder them.
I have a data grid where users can drag columns and reposition them. But
I'd like to implement a dragging feature where users can drag objects around the
I have a silverlight upload control. It handles drag&drop for files, quite good. Users
I have a Canvas (lets call it the Drop Box) which users can drag
I currently have a Rails Apps that lets users drag and drop certain elements
I have an HTML5 application that allows users to drag-n-drop an image to a
I'm attempting to allow my users to drag and drop certain rows of data
I have an app with 2 DataGridView's and have implemented Drag/Drop to allow the
I have made a script that allows users to drag images around. Unfortunatly though

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.