Openfiledialog DLG = new openfiledialog ();
DLG. Filter = "shape file (*. SHP) | *. SHP ";
DLG. Title = "Open the shape data document ";
DLG. multiselect = true;
// Define a string array for storing ifeatureclass
String [] filepath;
If (DLG. showdialog () = dialogresult. OK)
{
Filepath = new string [DLG. filenames. Length];
Filepath = DLG. filenames;
If (filepath. length> 0)
{
String workspacepath = system. Io. Path. getdirectoryname (filepath [0]);
String [] shapefilepath = new string [filepath. Length];
// Obtain the string array for enabling ifeatureclass
For (INT I = 0; I <filepath. length; I ++)
{
Shapefilepath [I] = system. Io. Path. getfilename (filepath [I]);
}
Iworkspacefactory pworkspacefactory = new shapefileworkspacefactoryclass ();
Iworkspace pworkspace = pworkspacefactory. openfromfile (workspacepath, 0 );
Ifeatureworkspace pfeatureworkspace = pworkspace as ifeatureworkspace;
For (INT I = 0; I <shapefilepath. length; I ++)
{
Ifeatureclass pfeatureclass = pfeatureworkspace. openfeatureclass (shapefilepath [I]);
Idataset pdataset = pfeatureclass as idataset;
Ifeaturelayer pfeaturelayer = new featurelayerclass ();
Pfeaturelayer. featureclass = pfeatureclass;
Pfeaturelayer. Name = pdataset. Name;
Ilayer player = pfeaturelayer as ilayer;
This. axmapcontrol2.map. addlayer (player );
}
}