MainWindow.xaml.csの全コード
using System.Windows;
namespace WpfAPictureViewer
{
public partial class MainWindow : Window
{
public MainWindow()
{InitializeComponent(); }
private void Button1_Click(object sender, RoutedEventArgs e)
{
if (myControl.OpenFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{myControl.PictureBox1.Load(myControl.OpenFileDialog1.FileName);}
}
private void Button2_Click(object sender, RoutedEventArgs e)
{myControl.PictureBox1.Image = null;}
private void Button3_Click(object sender, RoutedEventArgs e)
{
if (myControl.ColorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{ myControl.PictureBox1.BackColor = myControl.ColorDialog1.Color;}
}
private void Button4_Click(object sender, RoutedEventArgs e)
{ Close();}
private void CheckBox1_Checked(object sender, RoutedEventArgs e)
{ myControl.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;}
private void CheckBox1_Unchecked(object sender, RoutedEventArgs e)
{ myControl.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;}
}
}