public string LoadPicture() { string number = EE_Number_TextBlock.Text; if (number == "") { return("请输入能效编号"); } BitmapImage[] imagesouce = new BitmapImage[3]; string EEPath = FileTools.FindFiles(FileTools.pictureDirPath, EE_Number_TextBlock.Text, ".jpg"); string overprintPath = FileTools.FindFiles(FileTools.labelDirPath, EE_Number_TextBlock.Text, ".png"); string previewPath = FileTools.FindFiles(FileTools.pictureDirPath, EE_Number_TextBlock.Text, ".png"); if (EEPath != "") { EE_Piceture_Image.Source = new BitmapImage(new Uri(EEPath)).Clone(); } if (overprintPath != "") { Overprint_Picture_Image.Source = new BitmapImage(new Uri(overprintPath)).Clone(); Overprint_Number_TextBlock.Text = FileTools.GetFileShortName(overprintPath); } if (previewPath != "") { Preview_Picture_Image.Source = new BitmapImage(new Uri(previewPath)).Clone(); Preview_Number_TextBlock.Text = FileTools.GetFileShortName(overprintPath); } return(""); }
private void PictureChangeButtonClick(object sender, RoutedEventArgs e) { Button button = sender as Button; //string path = FileTools.OpenFile("*.png|*.png|*.jpg|*.jpg|*.jepg|*.jepg", ".png"); string path = FileTools.OpenFile("*.png|*.png|*.jpg|*.jpg", "*.png|*jpg"); _openImagePath = path; if (path.Length > 4) { txtAutoPrintNumber.Text = FileTools.GetFileShortName(path).Split('.')[0]; BitmapImage imagesouce = new BitmapImage(new Uri(path)); Overprint_Picture_Image.Source = imagesouce.Clone(); } }
public string LoadPicture() { if (PNumber == "") { return("没有编码"); } BitmapImage[] imagesouce = new BitmapImage[3]; string EEPath = FileTools.FindFiles(FileTools.pictureDirPath, PNumber, ".jpg"); string overprintPath = FileTools.FindFiles(FileTools.labelDirPath, PNumber, ".png"); string previewPath = FileTools.FindFiles(FileTools.pictureDirPath, PNumber, ".png"); if (overprintPath != "") { Overprint_Picture_Image.Source = new BitmapImage(new Uri(overprintPath)).Clone(); Overprint_Number_TextBlock.Text = FileTools.GetFileShortName(overprintPath).Split('.')[0]; txtOverprint_Picture.Visibility = Visibility.Hidden; } else { if (_openImagePath != "") { return("继续打印"); } else { return("找不到模板"); } } if (EEPath != "") { EE_Piceture_Image.Source = new BitmapImage(new Uri(EEPath)).Clone(); EE_Number_TextBlock.Text = FileTools.GetFileShortName(EEPath).Split('.')[0]; txtEE_Piceture.Visibility = Visibility.Hidden; } if (previewPath != "") { Preview_Picture_Image.Source = new BitmapImage(new Uri(previewPath)).Clone(); Preview_Number_TextBlock.Text = FileTools.GetFileShortName(previewPath).Split('.')[0]; txtPreview_Picture.Visibility = Visibility.Hidden; } return(""); }
private void PictureChangeButtonClick(object sender, RoutedEventArgs e) { Button button = sender as Button; string path = FileTools.OpenFile("*.png|*.png|*.jpg|*.jpg|*.jepg|*.jepg", ".png"); if (path.Length > 4) { string name = FileTools.GetFileShortName(path); foreach (RelationStruct keyValue in texts) { if (keyValue.name == button.Name) { BitmapImage imagesouce = new BitmapImage(); imagesouce = new BitmapImage(new Uri(path)); ((Image)keyValue.obj[1]).Source = imagesouce.Clone(); ((TextBox)keyValue.obj[0]).Text = name.Split(new char[] { '.' })[0]; break; } } } }
//选择模板按钮 private void ChoiceFileButtonClick(object sender, RoutedEventArgs e) { System.Windows.Controls.Button button = sender as System.Windows.Controls.Button; Template_TextBox.Text = FileTools.GetFileShortName(FileTools.OpenFile("*.png|*.png|*.jpg|*.jpg", "*.png|*jpg")); }