Tuesday 11 September 2012

Format Code to Post on Blog

This is my first post in this blog. I take many time to find "how to create a coding region in my post?", because I will share all experiments about any field which I research.

This is a post very interest about comparison of some ways to Post Code to your Blog. They have show all pros and cons: "How to Post Code To Your Blog and other Religious Arguments"
In my blog, I use a very simple way to create Format Code. It doesn't quite format things as nicely but it does allow you to copy and paste and retains all the line breaks and formatting. It is also an online editor that you can use for free.

To use this, we will need do this step:


1. Include CSS for format code into template of Blog. I will show you How to do with Blogger (Blogspot)
- Log in Blogspot.
- Go to Template and choice Customise.
- Copy content of this CSS file (download here) to text box (like picture) and press Apply to Blog.

2. Go to   http://dotnetslackers.com/articles/csharpformat.aspx   and generate your code with format.
3. Copy generate code to HTML of post and see result

        private void btnUpload_Click(object sender, EventArgs e)
        {
            Auth myAuth = flic.AuthGetToken(tempFrob);
            flic.AuthToken = myAuth.Token;

            string file = "Lena.bmp";
            string title = "Lena Photo";
            string description = "This is demo uploading with Lena Photo";
            string tags = "Lena";
            string photoID = flic.UploadPicture(file, title, description, tags);
            label1.Text = photoID;
            Photoset pset = new Photoset();
            pset.Title = "My new Photoset";
            flic.PhotosetsCreate("My new photoset", "Test outsite photo", photoID);
        }

No comments:

Post a Comment