//选择文件按钮事件 private void RelationFileButtonClick(object sender, RoutedEventArgs e) { string path = FileTools.OpenFile("*.txt|*.txt", ".txt"); if (path.Length > 4) { Relation_File_TextBox.Text = path; } }
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(); } }
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")); }