Brett Wolfington
Brett Wolfington

Reputation: 6627

Can't Move Controls With Mouse on Windows Form Designer

I recently installed Visual Studio 2013 Professional, and found that in the Windows Forms Application project type I'm unable to move any controls on a form in design mode. I tested a few alternatives out and found the following:

Furthermore, as you can see in the image below, the "cross" icon that indicates that the controls are movable is not visible on any controls.

A form showing no visible cross icon

I've tried the following, but have not yet been able to correct the issue:

Any suggestions would be appreciated.

Upvotes: 48

Views: 50262

Answers (11)

In my case it was that a big 7-Zip file was dragged and dropped to an archive just before, a huge file. While this drag & drop was in progress Windows can't do another one. It's a global singleton operation. In .NET the call 'DragDrop.DoDragDrop()' throws an exception 'System.Runtime.InteropServices.COMException' with a message "A drag operation is already in progress" (or similar). A good programming style would have reported this exception to the user but Visual Studio simply ends the drag attempt without info. So, the solution in my case was to let the Drop finish or abort the whole operation.

Upvotes: 1

Rekless
Rekless

Reputation: 169

I know this is an older thread, but this problem still persists. I am putting this here because I think some of these may work for others. The top option works for me, but is by no means a permanent solution. It helps to get your project completed though. Design your forms on your main screen then move VS to your secondary monitor to code kinda thing. I work off a laptop, so I don't like working on a small screen.

Some steps are rudimentary, but I was trying to be thorough. Sometimes it's the simple solution.

Preliminary troubleshooting...

  • Moving VS to main monitor(1) - this worked for me, but still doesn't allow me to use my 2 monitors
  • Run installer, select Repair
  • Run and cancel your project
  • Press the Esc button and see if things return to normal
  • Right click form "Lock Controls". This should not have the blue outline, or right click on form/control>Lock Controls and make sure nothing is locked.
  • Rebuild project, close and open the form again.
  • Snap to grid setting - Tools>Options>Windows Form Designer>General
  • Restart VS with 100% scaling - drawing may be an issue. I am not convinced it is not here since it works on the main screen but not the 2nd or 3rd
  • Dock property set to none for form/controls
  • Moving items very slowly with mouse - another indication drawing may be an issue.
  • Controls may not be docked in the container in which they reside. Restart VS. Try double clicking on the control, then move. I think this is indicative of creating the control outside a container(say, on a form), dragging it into another container(say, a tabControl) and then it not moving within that tabControl. Additionally, try creating new controls within their intended container and then trying to move them.
  • Close VS, delete C:\Users\user.name\AppData\Local\Microsoft\VisualStudio\15.0_xxxxxxxxx folder
  • Mouse driver - some software may cause issues here.
  • Absolute positioning - Tools>Options>Web Form Designer>CSS Styling>Change position...
  • Right click any item under toolbox and select "reset toolbox"

Requires Reboot...

  • Close VS. Delete some config files with current dates (devenv.exe.config, toolbox.tbd, toolbox_reset.tbd, toolboxindex.tbd, toolboxindex_reset.tbd) and reboot the PC. These are found in a directory like C:\Users\tdevy97\AppData\Local\Microsoft\VisualStudio\15.0_18c2eb4a where the last folder(15.0_18c2eb4a) is some random name. Reboot. Restart VS.

  • Corrupt toolbox? Close Visual Studio, Open the “c:\Users\AppData\Local\Microsoft\VisualStudio\14.0” folder and remove all the .TBD files, Start regedit, Find the “HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\ToolboxControlsInstaller_AssemblyFoldersExCache” and “HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\ToolboxControlsInstallerCache” keys, Remove everything from these keys leaving them empty, before you removing it, (back up your registry first), Reboot, Run Visual Studio again and wait until it recreates all items in the toolbox.

Last resorts...

  • Open command prompt as admin, navigate to your "IDE" directory (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE) and run the following commands...

    • devenv.exe /resetskippkgs, it will clear all SkipLoading tags that have been added to VSPackages by users who want to avoid loading problem VSPackages.
    • devenv.exe /resetsettings, it will restore Visual Studio default settings. Optionally resets the settings to the specified .vssettings file.
    • devenv.exe /resetuserdata, it will take a couple of minutes to run as Visual Studio cleans up and sets itself back to its original state. You may open Task Manager at this point to check whether the devenv.exe process is still running. After it has completed running, you can restart Visual Studio.
  • devenv.exe /uninstall /force - complete uninstall. Reboot. Reinstall. Rock on!

Upvotes: 12

Mario Favere
Mario Favere

Reputation: 510

I had this happening using multiple monitors. Move VS to the main monitor (1) and all will work fine. Greetz

Upvotes: 37

Ctrl S
Ctrl S

Reputation: 1103

I had this issue and tried solving it using some of the aforementioned methods, including pressing Esc, rebooting, and deleting the folder in AppData, but none of these worked for me.

"Solution"
I have a dual screen setup, and what I eventually did notice is that if Visual Studio starts up on Screen 1 and is then moved to Screen 2, the components will snap back to their initial location after being clicked and dragged. After moving the Visual Studio window back to Screen 1, the components click and drag as usual. I am unsure of the cause of this since it never used to be a problem, but for anyone using dual/multiple screens, this may "solve" the issue.

Upvotes: 5

Lucas Coelho
Lucas Coelho

Reputation: 603

None of these solutions worked for me. These are the steps that worked for me:

  1. Close Visual Studio
  2. Delete the Visual Studio AppData folder, usually at C:\Users\user.name\AppData\Local\Microsoft\VisualStudio. My folder was named 15.0_b148b13d, but your folder may have a similar name.

After deleting, Visual Studio took some time to initialize but I could finally drag the controls.

Upvotes: 1

Andreas Reiff
Andreas Reiff

Reputation: 8404

Answer to a slightly different question, but my googling lead me here, so perhaps it helps someone else.

If no movement works, also not with keyboard, check the "locked" property. That was it for me in a colleagues project, so I was not aware he had locked it.

The controls also have a tiny lock icon so if you look closely you will notice.

Upvotes: 1

Al Lelopath
Al Lelopath

Reputation: 6778

In my case, I had to change the Dock property to None.

Upvotes: 10

emonect
emonect

Reputation: 11

Found a solution!!

I had the same problem: Holding the mouse button and trying to move the element with no effects!

My solution: Try after pressing the mouse button to move the element very slowely - it works! I think it has maybe something to do with the mouse speed/acceleration settings. I changed them to the maximum. I guess VS has a problem with that. When i move the mouse slowely at the beginning then it works just fine!

Upvotes: 1

Brett Wolfington
Brett Wolfington

Reputation: 6627

It took some time but I finally found a workaround, if not an answer. As it happens, periodically my computer will stop allowing me to drag-and-drop anything. The solution to this is to press the Esc (escape) key, which instantly restores functionality.

Upvotes: 85

TH Todorov
TH Todorov

Reputation: 1159

I just found myself in similar, but slightly different situation - I could drag all controls without the "cross" icon such as buttons, but could not drag any control that had the "cross" icon such as group boxes and panels. One workaround that worked was to use the "arrow" keys to move the controls, but only a computer reboot fixed the issue. The solution, posted by Brett Wolfington did not work in my case.

Upvotes: 2

Niels Gjeding Olsen
Niels Gjeding Olsen

Reputation: 289

Seems its a drawing error. The controls actually moves, but there is a short time delay before you see it!

Upvotes: 0

Related Questions