示例#1
0
        private void OnScreenCaputred(object sender, ScreenShot2Lib.ScreenCaputredEventArgs e)
        {
            //set last size
            lastSize = new Size(e.Bmp.Width, e.Bmp.Height);


            Show();

            //test
            var bmp = e.Bmp;
            var win = new Window {
                SizeToContent = SizeToContent.WidthAndHeight, ResizeMode = ResizeMode.NoResize
            };

            var canvas = new Canvas {
                Width = bmp.Width, Height = bmp.Height, Background = new ImageBrush(bmp)
            };

            win.Content = canvas;
            win.Show();
        }
        private void OnScreenCaputred(object sender, ScreenShot2Lib.ScreenCaputredEventArgs e)
        {
            //set last size
            lastSize = new System.Windows.Size(e.Bmp.Width, e.Bmp.Height);


            Show();

            //test
            var bmp = e.Bmp;
            //var win = new Img { SizeToContent = SizeToContent.WidthAndHeight, ResizeMode = ResizeMode.NoResize };
            Img win = new Img {
                SizeToContent = SizeToContent.WidthAndHeight, ResizeMode = ResizeMode.NoResize
            };
            var canvas = new Canvas {
                Width = bmp.Width, Height = bmp.Height, Background = new ImageBrush(bmp)
            };

            win.Content = canvas;

            win.Show();
            //
            //string file="pic01";
            //ImageSave(canvas,file);

            var cdlg = new Microsoft.Win32.SaveFileDialog();

            cdlg.Filter = "*.jpg;*.bmp|*.jpg;*.bmp|*.png|*.png";

            cdlg.Title            = "保存";
            cdlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            if (cdlg.ShowDialog(this) == true)
            {
                System.Windows.MessageBox.Show(cdlg.FileName);
            }
            SaveToImage(canvas, cdlg.FileName);
        }