示例#1
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            string url;//将要保存文件的路径

            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "JPG格式(*.jpg)|*.jpg|JPEG格式(*.jpeg)|*.jpg|PNG格式(*.png)|*.png";
            saveFileDialog.InitialDirectory = "C:\\";
            saveFileDialog.ShowDialog();
            url = saveFileDialog.FileName;

            SavePic savePic = new SavePic();
            //savePic.SaveVisual(, url);
        }
示例#2
0
        private void Save_Button_Click(object sender, RoutedEventArgs e)
        {
            string url;//将要保存文件的路径

            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "JPG格式(*.jpg)|*.jpg|JPEG格式(*.jpeg)|*.jpg|PNG格式(*.png)|*.png";
            saveFileDialog.InitialDirectory = "C:\\";
            saveFileDialog.ShowDialog();
            url = saveFileDialog.FileName;

            var     control = listView as Control;
            SavePic savePic = new SavePic();

            savePic.SaveControl(control, url);
        }
        /// <summary>
        /// 保存图片到本地按钮的事件处理程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Save_Button_Click(object sender, RoutedEventArgs e)
        {
            string url;                                                                                     //将要保存文件的路径

            SaveFileDialog saveFileDialog = new SaveFileDialog();                                           //打开标准的Win32保存路径选择对话框

            saveFileDialog.Filter           = "JPG格式(*.jpg)|*.jpg|JPEG格式(*.jpeg)|*.jpg|PNG格式(*.png)|*.png"; //能选择的格式
            saveFileDialog.InitialDirectory = "C:\\";                                                       //设定初始的路径
            saveFileDialog.ShowDialog();
            url = saveFileDialog.FileName;                                                                  //获取对话框返回的路径

            SavePic savePic = new SavePic();                                                                //创建新的保存图片实例
            var     control = screenShot as Control;

            savePic.SaveVisual(control, url);//将控件按照指定路径保存为图片
        }