Visual Studio MFC application , click and drag function

gsegria 1 Reputation point
2020-10-07T07:56:04.393+00:00

I created a Visual Studio MFC dialog application.

There are 3 labels and texts on MyDialog.
Any way to add "click and drag function" ?

=============
line1 : label1 text1
line2 : label2 text2
line3 : label3 text3

=============
example:
User click and drag line 1 to line 3

=============
line2 : label2 text2
line3 : label3 text3
line1 : label1 text1

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,031 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,683 questions
{count} votes

2 answers

Sort by: Most helpful
  1. David Lowndes 4,711 Reputation points
    2020-10-07T08:35:06.43+00:00

    As far as I'm aware there's no built in means of doing what you want in the way you describe it.
    To do such things you'd normally use a control that has support, such as CDragListBox. However, for your stated requirement you'd probably need a more powerful 3'rd party grid control that could have other controls as cells in the grid. Have a look for grid controls such as Ultimate Grid to see if any of those will do what you need.

    0 comments No comments

  2. Castorix31 84,281 Reputation points
    2020-10-07T09:47:28.16+00:00

    If you have rows/columns, you can use a ListView (CListCtrl)
    You can find samples on Google, like A-Drag-and-Drop-List-Control.htm

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.