خواندن تمام خطوط یک فایل و قرار دادن در آرایه
کد:
using System;
namespace PlayingAround
{
class ReadAll
{
public static void Main(string[] args)
{
string[] lines = System.IO.File.ReadAllLines(@"C:t1");
Console.Out.WriteLine("contents = " + lines.Length);
Console.In.ReadLine();
}
}
}
گرفتن ScreenShot از صفحه نمایش
کد:
private void button1_Click(object sender, EventArgs e)
{
int screenWidth = Screen.PrimaryScreen.Bounds.Width;
int screenHeight = Screen.PrimaryScreen.Bounds.Height;
Graphics Graphics1;
Bitmap Bitmap1 = new Bitmap(screenWidth, screenHeight);
Graphics1 = Graphics.FromImage(Bitmap1);
Graphics1.CopyFromScreen(Point.Empty, Point.Empty, Screen.PrimaryScreen.Bounds.Size);
Bitmap1.Save(@"c:\1.bmp");
}