WebBrowser.DrawToBitmap()

public partial class Form1 : Form
{
WebBrowser wb = new WebBrowser();
public Form1()
{
InitializeComponent();
wb.Height = 100;
wb.Width = 100;
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
}

void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
Bitmap bmp = new Bitmap(100, 100);
wb.DrawToBitmap(bmp, new Rectangle(wb.Location.X, wb.Location.Y, wb.Width, wb.Height));
this.pictureBox1.BackgroundImage = bmp;
}
}
ที่มา: http://thepursuitofalife.com/the-missing-drawtobitmap-function-in-the-net-webbrowser-class/

Reading and Writing Text Files

using System;
using System.IO;

class TextFileWriter
{
static void Main(string[] args)
{
// create a writer and open the file
TextWriter tw = new StreamWriter(“date.txt”);

// write a line of text to the file
tw.WriteLine(DateTime.Now);

// close the stream
tw.Close();
}
}

using System;
using System.IO;

class TextFileReader
{
static void Main(string[] args)
{
// create reader & open file
Textreader tr = new StreamReader(“date.txt”);

// read a line of text
Console.WriteLine(tr.ReadLine());

// close the stream
tr.Close();
}
}
http://www.csharp-station.com/HowTo/ReadWriteTextFile.aspx

Image Capture Whole Web Page using C#

Image Capture Whole Web Page using C#
http://www.codeproject.com/KB/graphics/IECapture.aspx
Capture Entire Web Page using VB.Net (ทำการ CapturePage ที่ยาวๆ ได้ทั้ง Page เลย)
http://www.codeproject.com/KB/vb/WebCapture.aspx

Screen Capturing
http://www.codeproject.com/kb/graphics/ScreenCaptureByHolzhauer.aspx

TeboScreen: Basic C# Screen Capture Application
http://www.codeproject.com/KB/cs/TeboScreen.aspx

How to: Simulate Mouse and Keyboard Events in Code

How to: Simulate Mouse and Keyboard Events in Code

http://msdn.microsoft.com/en-us/library/ms171548.aspx

SendKeys.Send Method
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx

MouseSimulator
http://stackoverflow.com/questions/5094398/how-to-programatically-mouse-move-click-right-click-and-keypress-etc-in-winform

mouse_event function
http://msdn.microsoft.com/en-us/library/ms646260(VS.85).aspx 
Imitate mouse click
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ebe2c146-03ca-40eb-990d-093fbd3d4886/

File and Directory Manipulation

using System.IO;
class TestDirectory {
public static void Main() {
Directory.CreateDirectory(“C:\\csharp”);
}
}

The above lines of codes will create a directory in your C:
Please note that the backslash(\) should be escaped by another backslash since it is a escape character. Moreover, remember to “using” the System.IO namespace so as to use these classes.
Following are a list of useful methods:

1. To create a subdirectory “dump” in C:\csharp just created:
Directory.CreateDirectory(“C:\\csharp\\hello”);

2. To move a directory from one place to another:
Directory.Move(“C:\\csharp\\hello”, “C:\\hello”);

3. To delete a directory:
Directory.Delete(“C:\\hello”);

4. To copy a file to another location, or to a different name:
File.Copy( “c:\\friends.jpg”, “c:\\temp\\abc.jpg”);

5. To move a file from one place to another:
File.Move( “c:\\friends.jpg”, “c:\\temp\\friends.jpg”);

6. To delete a file:
File.Delete( “c:\\friends.jpg” );

Ref: http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=54