JN7.net

Kısayol Oluşturma- Ekran Görüntüsü Yakalama

Kısayol Oluşturma

Bir buton ekliyorsunuz ve butonun içine bu kodu yazın.

using IWshRuntimeLibrary;
//////////////////////////////////////////////////////////////////////////////////////////
private void button1_Click(object sender, EventArgs e)
{
WshShell shell = new WshShell();
IWshShortcut MyShortcut;
//  [UserName] Bilgisayarın kendi kullanıcı adını yazacaksınız.

MyShortcut = (IWshShortcut)shell.CreateShortcut(@"C:\Documents and Settings\[UserName]\Start Menu\Programs\MyShortcut.lnk");
MyShortcut.TargetPath = Application.ExecutablePath;
MyShortcut.Description = "Launch the App!";
// MyShortcut.IconLocation = [IconPath]; // [IconPath] - Kısaylun varsa resim yolunu yazın

MyShortcut.Save();
}

Ekran Görüntüsü Yakalama

using System.Drawing.Imaging;
using System.Threading;

///////////////// Declarations ////////////////////////
ImageFormat img; Bitmap bt; Graphics screenShot;

///////////////////// Button1 /////////////////////////////
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
this.Hide();
// This gives time to the Form to hide before it takes the screenshot. 500 miliseconds are enough.
Thread.Sleep(500);
// Set the image to the size of the screen.
bt = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
// Creates the graphic object for the image (bt).
screenShot = Graphics.FromImage(bt);
// Takes the screenshot.
screenShot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size,

CopyPixelOperation.SourceCopy);
switch (saveFileDialog1.FilterIndex)
{
case 0: img = ImageFormat.Bmp; break;
case 1: img = ImageFormat.Png; break;
case 2: img = ImageFormat.Jpeg; break;
}
// Saves the image.
bt.Save(saveFileDialog1.FileName, img);
// After the screenshot is taken the Form reappears.
this.Show();
}

Leave reply

Back to Top