using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace TestShapeControl { public partial class Form7 : Form { public Form7() { InitializeComponent(); } private void cmdSave_Click(object sender, EventArgs e) { if (ShapeControl.CustomControl1.SaveToFile(ctrlarrow1, Application.StartupPath + "\\mytestarrow.shp.jpg", false) == false) MessageBox.Show("Save Failed"); else MessageBox.Show("mytestarrow Saved"); } private void cmdLoad_Click(object sender, EventArgs e) { if( ShapeControl.CustomControl1.LoadFromFile(ctrl1, Application.StartupPath + "\\mytestarrow.shp.jpg",false)==false) MessageBox.Show("Load Failed"); else cmdSave2.Visible = false; } private void cmdSave2_Click(object sender, EventArgs e) { if(ShapeControl.CustomControl1.SaveToFile(ctrl1, Application.StartupPath + "\\mytestplane.shp.jpg",false)==false) MessageBox.Show("Save Failed"); else MessageBox.Show("mytestplane Saved"); } private void cmdLoad2_Click(object sender, EventArgs e) { if(ShapeControl.CustomControl1.LoadFromFile(ctrlarrow1, Application.StartupPath + "\\mytestplane.shp.jpg",false)==false) MessageBox.Show ("Load Failed"); else cmdSave.Visible = false; } private void Form7_Load(object sender, EventArgs e) { if (File.Exists(Application.StartupPath+"\\mytestarrow.shp.jpg")) File.Delete (Application.StartupPath+"\\mytestarrow.shp.jpg"); if (File.Exists(Application.StartupPath + "\\mytestarrow.shp")) File.Delete(Application.StartupPath + "\\mytestarrow.shp"); if (File.Exists(Application.StartupPath+"\\mytestplane.shp.jpg")) File.Delete (Application.StartupPath+"\\mytestplane.shp.jpg"); if (File.Exists(Application.StartupPath + "\\mytestplane.shp")) File.Delete(Application.StartupPath + "\\mytestplane.shp"); } } }