Friday, 9 November 2012

Adding 'Console Out' to VisualStudio IDE as a native Window

Michael Hidalgo has posted two blog entries where he uses the O2's VisualStudio Extension to open an Console Out window inside VisualStudio, which is then used to help with a quick test on the DateTime object (and making his life easier)

Micheal is using the API_ConsoleOut.cs (which you can read in more detail at API_ConsoleOut.cs – New and InProcess Capture of the Console Output ) to add a 'Console OutPanel to a Form Window.

Now this Form object is a WinForms control and is not a native VisualStudio Window, which means that we can't add it to the VisualStudio Panes.

A better option is to make this a native VisualStudio Window, which is quite easy to do.

Open the C# REPL - VisualStudio 2010 API (from the REPL menu)

And with the VisualStudio_2010 object:

Create a native VisualStudio window (with a WinForms Panel inside it):

Use the same add_ConsoleOut extension method on the Panel object (the one returned by the open_Panel extension method):

And now the Console Out is now inside a native VisualStudio window, which we can access and manipulate.

Here is an example of changing the base window's width, height, top and left values:

Which of course we can now put anywhere inside VisualStudio's GUI

Next see the Viewing 'Console Out' messages created inside UserControls (when rendered by VisualStudio's Form Designer) for a practical example of using this technique during development.
Post a Comment