c++
int leftOffset = int.Parse(LeftOffset.Text);
int topOffset = int.Parse(TopOffset.Text);
int width = int.Parse(RadarWidth.Text);
int height = int.Parse(RadarHeight.Text);
Image screen = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(screen))
{
g.CopyFromScreen(leftOffset, topOffset, 0, 0, new System.Drawing.Size(width, height));
g.Dispose();
}
string imagePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}\\Screen.jpg";
screen.Save(imagePath);
screen.Dispose();
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.UriSource = new Uri(imagePath);
bitmapImage.EndInit();
ScreenshotImage.Source = bitmapImage;
c++
int leftOffset = int.Parse(LeftOffset.Text);
int topOffset = int.Parse(TopOffset.Text);
int width = int.Parse(RadarWidth.Text);
int height = int.Parse(RadarHeight.Text);
Image screen = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(screen))
{
g.CopyFromScreen(leftOffset, topOffset, 0, 0, new System.Drawing.Size(width, height));
g.Dispose();
}
string imagePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}\\Screen.jpg";
screen.Save(imagePath);
screen.Dispose();
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.UriSource = new Uri(imagePath);
bitmapImage.EndInit();
ScreenshotImage.Source = bitmapImage;