The program below displays some pictures and has some buttons to manipulate the visibility of that pictures. Wat i want is to capture only the content of the main window of the program on a bitmap (not the arrow of the mouse), using the ''p'' key of the
keyboard and save the files in the directory where the program is located, (wherever the program is located in any machine) and also save multiple screenshots of the program and named them by an increasing number, mainwindow_1, mainwindow_2 etc.
I tried to modify the code of this guy's blog
which as he say does almost exactly what i want... but i cant get it to work.
I hope i dont ask too much...
Thanks in advance
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApp2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (linevertical.Visibility == Visibility.Hidden)
{ linevertical.Visibility = Visibility.Visible; }
else { linevertical.Visibility = Visibility.Hidden; }
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
if (lineo.Visibility == Visibility.Hidden)
{ lineo.Visibility = Visibility.Visible; }
else { lineo.Visibility = Visibility.Hidden; }
}
private void Mainwindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.A)
{
lineo.Visibility = Visibility.Hidden;
linevertical.Visibility = Visibility.Hidden;
}
if (e.Key == Key.S)
{
lineo.Visibility = Visibility.Visible;
linevertical.Visibility = Visibility.Visible;
}
}
}
}