PDA

View Full Version : سوال: پرینت اسکرین از دسکتاپ



drsina
پنج شنبه 20 تیر 1392, 02:01 صبح
سلام دنبال کدی بودی بتونه از دسکتاپ پرینت اسکرین بگیره و در دایرکتوری خاصی ذخیره کنه ! ؟

esafb52
پنج شنبه 20 تیر 1392, 02:28 صبح
private void picget()
{
//Will contain screenshot
Bitmap screenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
Graphics screenshotGraphics = Graphics.FromImage(screenshot);
//Make the screenshot
screenshotGraphics.CopyFromScreen(Screen.PrimarySc reen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
screenshot.Save("c:\\1." + ImageFormat.Jpeg);
}

c-sharp_South
پنج شنبه 20 تیر 1392, 03:07 صبح
using System.Drawing.Imaging;



try
{
int width, height;
width = System.Windows.Forms.SystemInformation.PrimaryMoni torSize.Width;
height = System.Windows.Forms.SystemInformation.PrimaryMoni torSize.Height;
//The following code will capture the screen and save it in the desktop as image.bmp;
Bitmap image;
Rectangle screen = Screen.AllScreens[0].Bounds;
image = new Bitmap(width, height, PixelFormat.Format32bppArgb);
Graphics Graph = Graphics.FromImage(image);
Graph.CopyFromScreen(screen.Left, screen.Top, 0, 0, screen.Size);
string savePath = Environment.GetFolderPath(Environment.SpecialFolde r.MyComputer) + @"d:\\Image.bmp";
image.Save(savePath);
}
catch { }

CsharpNevisi
پنج شنبه 20 تیر 1392, 11:49 صبح
سلام ... من یه برنامه نوشتم که از دسکتاپ عکس میگیره ویرایش میکنه افکت میزاره و .... !!!
اگه به دردت میخوره بگو برات بزارم .. !!!

shahryari
پنج شنبه 20 تیر 1392, 12:02 عصر
سلام
ساده ترین راهش اینه که با دستور sendkeys کلید printscrin رو به صفحه کلید ارسال کنی و سپس در یک متغیر از نوع bitmap از کلیب بورد بگیری و در فایل ذخیره کنی

مثال (البته در وی بی نوشتم و میتونید تبدیلش کنید)
SendKeys.Send("{PRTSC}")
Dim b As New Bitmap(My.Computer.Clipboard.GetImage)
b.Save("C:\test\test.jpg")