Ejemplo n.º 1
0
        private void CopySelectedGrab(object sender, ExecutedRoutedEventArgs e)
        {
            var         imgdata = SelectedCapture.ImageAsJpg();
            Image       img     = Image.FromStream(imgdata);
            IDataObject dataObj = new DataObject();

            dataObj.SetData(img);
            WpfClipboard.SetClipboardDataObject(dataObj);
        }
Ejemplo n.º 2
0
        private void SaveSelectedGrab(object sender, ExecutedRoutedEventArgs e)
        {
            SaveFileDialog diag = new SaveFileDialog {
                Filter = @"JPG Image (*.jpg)|*.jpg"
            };

            diag.ShowDialog();
            if (String.IsNullOrEmpty(diag.FileName))
            {
                return;
            }

            var imgdata = SelectedCapture.ImageAsJpg();

            using (Stream file = File.OpenWrite(diag.FileName)) {
                imgdata.Position = 0;
                CopyStream(imgdata, file);
                file.Close();
            }
        }