I need to build a C# WPF Application within Visual Studio that will do the follo
ID: 3556015 • Letter: I
Question
I need to build a C# WPF Application within Visual Studio that will do the following tasks.
1. Button to Load images onto the screen from file.
2. When the image uploaded is clicked on, it will add a fillable textbox at the clicked location.
3. Button to Save that image with the added text.
4. Button to Print that image.
*This program will be used to open blank documents from file, add text entries, then be able to save/print for future use.*
Full rating to someone that can create this program that will do all 4 of the things listed above.
Please include both MainWindow.XAML and MainWindow.XAML.cs
**Tutoring Spam will be flagged**
Explanation / Answer
Code to open the file browser
string filepath;
//browse Button
private void button4_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Multiselect = false;
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
bool? result = open.ShowDialog();
if (result == true)
{
filepath = open.FileName; // Stores Original Path in Textbox
ImageSource imgsource = new BitmapImage(new Uri(filepath)); // Just show The File In Image when we browse It
Clientimg.Source = imgsource;
}
}
And below is the code used for saving the file
private static String GetDestinationPath(string filename, string foldername)
{
String appStartPath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
appStartPath = String.Format(appStartPath + "\{0}\" + filename, foldername);
return appStartPath;
}
How to use it
string name = System.IO.Path.GetFileName(filepath);
string destinationPath = GetDestinationPath(name,"YourFolderName");
File.Copy(filepath, destinationPath, true);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.