Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hidden Features of Visual Studio winforms designer [closed]

One of the most loved and hated feautures of visual studio must be the form designer.

Creating a simple form/user control layout usually is a breeze. Setting properties and adding events is easy.

Setting up the toolbox to use you own controls can be a bit harder and getting the ToolBoxIcons to show up can be a pain. Using third party components by visual inheritance can throw of the designer. And using multiple inheritance on designerables can be really hard.

So what are your favorite 'hidden' and or obvious visual studio designer features.

like image 372
CodingBarfield Avatar asked Nov 04 '10 09:11

CodingBarfield


People also ask

Can't see Windows Form Designer?

If you are viewing the code then Shift-F7 should show the designer. Alternatively in the Solution Explorer right click on the form and select View Designer. If that doesn't work make sure you have the class definition in your form code file, generally Form1. vb.

How do I see the Form Design in Visual Studio?

From the Solution Explorer window select your form, right-click, click on View Designer. Voila! The form should display. Save this answer.

How do I open designer CS?

So open the solution explorer (View -> Solution Explorer, or Ctrl + W , S ). Select one of the mentioned classes like form or user control. Right-click it and from the context menu select View Designer (or simply Shift + F7 ). That will move you to the designer view.


3 Answers

  • Hold down CTRL and drag a control to duplicate it.

NOTE: Be careful, if your control has an event handler that was created by the designer, it will associate your newly created control with the event handler as well as the old control.

  • Use the keyboard shortcut F7 to go from the designer view to the code view, and Shift-F7 to go from the code view to the designer view. I use this constantly

  • The "Document Outline" window is essential for heavy designer use. This allows you to reorder the controls in the outline to bring them to the front or send to back. It's especially useful when you're working with docking controls. You can also move a child control to a different parent, or take it out of a container control, or move a parent into a container, etc...

View -> Other Windows -> Document Outline

  • The "Layout" toolbar is great for lining things up to make a clean looking user interface.

View -> Toolbars -> Layout

like image 56
Fake Avatar answered Oct 22 '22 02:10

Fake


When the WinForms project designer is open on a form or user control and you have nested child controls, you can move the focus off of the currently focused child control to its parent control by pressing the Escape key. Pressing the Escape key again moves focus to its parent and so on until you finally reach the top.

like image 35
Elan Avatar answered Oct 22 '22 04:10

Elan


Did you know you can actually debug the designer?

You can start up a single solution twice and use 'Attach to process' to debug a devenv environment running your designer controls. This can be especially helpfull to debug 'strange' designer problems that give very little information otherwise.

I used this to pinpoint a designer problem to some remoting that got started and didn't work triggering an unhandled exception and breaking the designer. All I saw at the desigerview was some visual studio internal helper classes crashing.

like image 5
CodingBarfield Avatar answered Oct 22 '22 03:10

CodingBarfield