8 Microsoft Visual Studio Keyboard Shortcuts You Need to Know Today

150 150 rhecht

Here are eight of my favorite keyboard shortcuts in Visual Studio. There’s a good chance at least one of them will be new to you.

1. Move Code Alt+Up/Down

This keyboard shortcut is new in Visual Studio 2013. If you put the cursor on a line of code and use the Alt+Up Arrow keys, the line of code you’ve selected moves up. If you use the Alt+Down Arrow keys, the line of code selected moves down.

2. Create Collapsible Region Ctrl+M+H/Ctrl+M+U

Chances are you’ve noticed the “+” and “-” symbols in the margins that let you collapse and expand your classes and functions. Did you know you can create your own collapsible regions? If you select a section of code and then use the key sequence Ctrl+M+H, you turn that region into a collapsible/expandable region. The key sequence Ctrl+M+U will remove the collapsible region. It doesn’t delete the code, it just removes the icon that lets you expand and collapse.

3. Comment Code Block Ctrl+K+C/Ctrl+K+U

Whether it’s because you’re trying to track down a “but,” or experimenting with code change, from time to time you’ll want to comment and uncomment blocks of code. If you select a block of code and use the key sequence Ctrl+K+C, you’ll comment out the section of code. Ctrl+K+U will uncomment the code.

4. Peek Definition Alt+F12

When you’re going through your code and you want to examine the code in the method you’re calling, many programmers will use the F12 key or the pop-up menu option Go To Definition. Go To Definition will navigate to the called method; however, many times you don’t need to navigate to the code. Sometimes, you just want a quick look at the method. If you’ve installed Visual Studio 2013, there’s a new keyboard shortcut — Alt+F12 — that will give you a preview of the method being called inline. You can use the Esc key to close the preview.

5. Navigate Forward/Backward Ctrl+–/Ctrl+Shift+–

When you have multiple files open at the same time, you might want a way to quickly move back and forth between two or three different locations in your code. If you’ve moved from one location to another you can use the keyboard sequence <Ctrl>+– to move to the previous location and then you can return using Ctrl+Shift+–.

6. Ctrl-Shift-S

Saves all documents and projects. Very useful when you have many items open and are too lazy to go to the top left “File->Save All.”

7. F7

Switches from the design view to the code view in the editor.

8. Shift-F7

Switches from the code view to the design view in the editor.


Generating ASP.NET Images on the Fly

150 150 afischer

ASP.NET is a highly efficient framework by Microsoft, primary used for interactive web and app development. It is quite easy to generate dynamic graphics with the ASP.NET framework even on the fly. With classic ASP (Active Server Pages), on the other hand, it had been a tedious task to produce images. The .NET framework has brought the much-appreciated change.

With classic ASP, programmers had to use third party components such as “ASPPicture” and “ASPImage” to generate dynamic images. The ASP.NET is now extremely helpful in generating images through a few simple steps. Developers can just fabricate lively images via a set of image manipulation capabilities, which are directly embedded to the .NET framework classes.

The Technical Origins Behind the Dynamic Image Manipulation

Microsoft develops and markets the ASP.NET framework for developing dynamic web sites, web apps and services. The Redmond software giant launched the framework in 2002 with version of 1.0 of the .NET framework. The ASP.NET is developed on the Common Language Runtime (CLR). Hence, it is possible for developers to write ASP.NET code with any .NET supported languages. Thus, it is very easy to get dynamic images generated with the ASP.NET framework.

Technical Requirements to Create Images on the Fly

In order to create images on the fly using ASP.NET, the developer is expected to install IIS and the .NET framework on the system. To write the .NET code, applications like Visual Studio.NET or Notepad can be used. Further, the programmer needs to build an ASP.NET page to create a bar chart with three bars. The programmer should select height of the bars to generate a GIF image and to display it on a webpage.

The Process

In brief, the process contains four major steps.

1. The programmer has to create a blank Bitmap object with right dimensions.
2. A bar chart (image) should be drawn on the Bitmap. For this Graphics and information from user can be accepted.
3. The programmer can convert the finished image to GIF format.
4. The GIF can be sent to the output stream and the browser.

The default content-type value of the output will be “text/html.” But, if the programmer wants to output an image, the content-type will need to go like “image/gif.” The most important thing is that after drawing an image, the programmer should save the Bitmap to an output stream. So as to send the image to the browser, the Bitmap should be saved to “HTTP” output stream.

Of course, ASP.NET presents an easy way to create dynamic images on the fly. Developers can instantly manipulate graphics with better results. Many programmers feel that ASP.NET offers lots of performance benefits over other script-based frameworks which includes the previous Classic ASP. The .NET framework is such useful that it can compile the server-side code to several DLL files on the web server. As a whole, ASP.NET is the best way for one to get dynamic images designed instantly.


Valuable Resources:

Generating ASP.NET Images on the Fly – By Sitepoint