private void buttonExchangeIconChange_Click(object sender, EventArgs e)
{
DialogResult res = this.openFileDialogIcon.ShowDialog();
if (res != System.Windows.Forms.DialogResult.OK)
return;
byte[] icon = null;
try
{
using (System.IO.FileStream filestream = new System.IO.FileStream(this.openFileDialogIcon.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
icon = new byte[filestream.Length];
filestream.Read(icon, 0, icon.Length);
}
this.panelIcon.BackgroundImage = Image.FromStream(new System.IO.MemoryStream(icon));
if(this.m_target is DocExchangeDefinition)
{
((DocExchangeDefinition)this.m_target).Icon = icon;
}
else if(this.m_target is DocModelView)
{
((DocModelView)this.m_target).Icon = icon;
}
}
catch(Exception x)
{
MessageBox.Show(this, x.Message, "Error", MessageBoxButtons.OK);
}
}