Use CopySourceAsHtml + CSS to create the source code style on the Dflying Chen blog

Source: Internet
Author: User
In a very interesting open-source VS2005 plug-in: CopySourceAsHtml, You can see CopySourceAsHtml, and install VS2005 in Chinese. In addition, it is open-source, the solution that can be found in the Bug that the CopySourceAsHTML plug-in cannot be used in Chinese VS2005 is fixed ,.
I have also modified some of the settings, and added the background color of adjacent rows,
And make some modifications that you think you need. The modified DLL can be downloaded here: CopySourceAsHtml. dll.

Add a style sheet: The. cf style comes from Dflying Chen's blog.

Style example:/* CopySourceAsHtml Style */
. Cf {
Font-family: consolas, "Courier New", courier, monospace;
Font-size: 1.2em;
Color: black;
Background-color: # fff;
Line-height: 1em;
/* White-space: pre ;*/
}
. Cf p. cl {margin: 0; padding: 0;}/* Common row */
. Cf p. cl_alt {margin: 0; padding: 0; background-color: # f4f4f4;}/* adjacent row */
. Cln {color: # 2b91af;}/* row number */
. Cb_green {color: green;}/* by color */
. Cb_blue {color: blue ;}
. Cb_2b91af {color: # 2b91af ;}
. Cb_a31515 {color: # a31515 ;}
. Cb_red {color: red ;}

Example:
Without line number:

Public static void SetHtml (string html)

{

 

DataObject data;

 

Data = new DataObject ();

Data. SetData (DataFormats. Text, true, html );

// Data. SetData (DataFormats. UnicodeText, true, html );

Data. SetData (DataFormats. Html, true, EncodeHtml (html ));

// MessageBox. Show (data. GetText (TextDataFormat. Html ));

System. Windows. Forms. Clipboard. SetDataObject (data, true );

 

}

With row number:

34 public static void SetHtml (string html)

35 {

36

37. DataObject data;

38

39 data = new DataObject ();

40 data. SetData (DataFormats. Text, true, html );

41 // data. SetData (DataFormats. UnicodeText, true, html );

42 data. SetData (DataFormats. Html, true, EncodeHtml (html ));

43 // MessageBox. Show (data. GetText (TextDataFormat. Html ));

44 System. Windows. Forms. Clipboard. SetDataObject (data, true );

45

46}

I hope Dflying Chen can copy his style.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.