【注:数据库中保存图片的数据类型最好是varbiary(max)】
1.图片预览功能:
private void btn_preview_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openfiledialog = new OpenFileDialog();
openfiledialog.Filter = "图片(*.jpg;*.png;*.gif;*.bmp;*.jpeg)|*.jpg;*.png;*.gif;*.bmp;*.jpeg";
if ((bool)openfiledialog.ShowDialog())
{
BitmapImage bitmapimg = new BitmapImage(new Uri(openfiledialog.FileName));
image1.Source = bitmapimg;
//image1.Wid
{
OpenFileDialog openfiledialog = new OpenFileDialog();
openfiledialog.Filter = "图片(*.jpg;*.png;*.gif;*.bmp;*.jpeg)|*.jpg;*.png;*.gif;*.bmp;*.jpeg";
if ((bool)openfiledialog.ShowDialog())
{
BitmapImage bitmapimg = new BitmapImage(new Uri(openfiledialog.FileName));
image1.Source = bitmapimg;
//image1.Wid