Let's comment out the portion that calculates the string position.
#UNCOMMENT VISUAL STUDIO SHORTCUT CODE#
The above code centers a string message in a Form's OnPaint method. SizeF msgSize = g.MeasureString(message, this.Font) String message = '.NET Compact Framework' Protected override void OnPaint(PaintEventArgs e) To illustrate this feature, I will use the following simple method: To comment out a selection, we first highlight the code: And then just press 'Ctrl+K, C': Thats it. Licensed under: CC-BY-SA with attribution. to uncomment a selected block of code in Visual Studio : Ctrl+K+U. to comment a selected block of code in Visual Studio : Ctrl+K+C. To return to the normal selection just repeat the same shortcut. For languages which do not support multi-line comments, this saves a lot of time. They shortcut to comment out a block of code is 'Ctrl+K, C' or 'Ctrl+E, C' (as a reminder, Im using the default C settings in Visual Studio). There were Ctrl+E+C (comment) and Ctrl+E+U (uncomment) in older versions, or Ctrl+K+C and Ctrl+K+U. The shortcut in Mac is Ctrl + Shift + R as explained in this thread. While that is a fast / easy way to comment out a block of code, this is even easier, especially when I discover that I already have a multi-line comment block within the code I wish to disable. For years, I've been a C/C++/C# multi-line comment person, manually adding /* and */ around any code I wanted to temporarily remove. I asked him what he just did and he introduced me to the handy comment / uncomment buttons.
![uncomment visual studio shortcut uncomment visual studio shortcut](https://www.crazyshortcut.com/wp-content/uploads/2019/07/Visual-Studio-Shortcuts-Keyboard-Shortcuts-PDF-1-1280x720.jpg)
![uncomment visual studio shortcut uncomment visual studio shortcut](https://i.stack.imgur.com/0E9m8.png)
We were looking at some code and he selected a line, clicked a button, on the toolbar, and the line was commented out. Yesterday, I was talking with one of the folks here and I learned something about Visual Studio.