Thursday, 27 January 2011

How to retain formatting of code copied from Visual Studio IDE

Here's a quick tip that I just found out by accident. If you want to retain the colours that Visual Studio applies to the different elements in your code, first copy and paste the code into Word and from there copy and paste into the Blogger edit box.

Below you can see that the red, green and blue colours are retained:


' Sets the default value of TabStop to true when the component is first added to the form.
Public Overrides Sub InitializeNewComponent(ByVal defaultValues As IDictionary)
    MyBase.InitializeNewComponent(defaultValues)
    Dim d = TypeDescriptor.GetProperties(MyBase.Component).Item("TabStop")
    ...
End Sub

 

No comments:

Post a Comment