MrDave's (David Yack) WebLog

September 2004 - Posts

VS Macro / Shortcuts to Expand / Collapse all regions

Using regions in code to break up and make it easy to look at seems to becoming more popular.

I have to admit I have a love / hate relationship with regions because sometimes they just get in the way.

Ran across a post from Roland Weigelt where he has a macro that helps expand / collapse all the regions in a source file.

Here’s the link to the post Better Keyboard Support for #region ... #endregion

Roy Osherove also provided the following key strokes that are built into Visual Studio:

CTRL+M CTRL+M (that's two key presses!) - collapse/open the current parent region

CTRL+M CTRL+L - Collapse/Open all regions in document recursively (meaning you might get only one line in the document - one big namespace region which is collapsed or you'll see the entire page code uncollapsed

CTRL+M CTRL+O - Collapse all regions not recursively -

Thanks Roland and Roy!

 

Visual Studio 2005 Custom Controls in Toolbox

 Looks like registering custom controls on the toolbox has been improved dramatically in Visual Studio 2005!

 

Prior to 2005 if you had projects in your solution that had custom controls you would still have to register them with Toolbox to get them to appear.  This also caused locking and contention issues on the output from those projects when visual studio held locks on the file.

 

Now in Visual Studio 2005 when you have a project in your solution that has custom controls they appear in the toolbox without any user intervention!  This is great because now you can simply drag and drop your controls onto your pages / forms without having to deal with the old issues.  Each project that has controls adds a tab in the toolbox and then each control is listed inside that tab.

 

This is a great extra incentive if you haven’t tried building a custom control to give it a try – even if you just extend one of the built-in controls to get started.

 

It’s always fun exploring a new version and finding all the little fixes to things that drove you crazy in the old version!

 

More Posts