Selection by polygon

Hello!
Regarding the selection of objects on the map polygon. I did as follows.
If possible, please insert this code into the MapWinGis documentation in the “examples” section. Thanks you!

#region ----------Selected layer----------
//Select By Polygon
private void btnSelectByPolygon_Click(object sender, EventArgs e)
{
axMap1.CursorMode = tkCursorMode.cmSelectByPolygon;
}
//Duble Click to Finish Select By Polygon
private void axMap1_DblClick(object sender, EventArgs e)
{
axMap1.ShapeEditor.SaveChanges();
}
//Select by Rectangle
private void btnSelection_Click(object sender, EventArgs e)
{
axMap1.CursorMode = tkCursorMode.cmSelection;
}
//layer selection
private void axMap1_ChooseLayer(object sender, DMapEvents_ChooseLayerEvent e)
{
e.layerHandle = 0;
}
//
private void axMap1_SelectionChanged(object sender, DMapEvents_SelectionChangedEvent e)
{
get_selected_attribute(e.layerHandle);
}
//Get attribute from selected layer
private void get_selected_attribute(int layerHandle)
{
try
{
var sf = new Shapefile();
sf = axMap1.get_Shapefile(layerHandle);
//string expression = “”;
string data
= “”;
/for (int i = 1; i < sf.NumFields; i++)
{
expression += “[” + sf.Field[i].Name + “]”;
}
/
int fieldIndex = sf.Table.FieldIndexByName[“num”];
if (fieldIndex != -1)
{
for (int i = 0; i < sf.NumSelected; i++)
{
data
+= “[” + (string)sf.CellValue[fieldIndex, i].ToString() + “]”;
}
}
MessageBox.Show("Objects: " + sf.NumSelected.ToString() + "\n Value: " + data_);
//MessageBox.Show("Objects: “+sf.NumSelected.ToString()+”,\n Fields: “+expression+”,\n Value: "+ data_);
}
catch (Exception ex)
{
MessageBox.Show("Ошибка: " + ex, “Ошибка”, MessageBoxButtons.OK);
return;
}
}
#endregion

if you need to select the desired layer, then I did it

>private void axMap1_ChooseLayer(object sender, _DMapEvents_ChooseLayerEvent e)
    {
        int handle = 0;
        int thishandle = 0;
        int result = 0;
        while (handle < axMap1.Layers.Count)
        {
            if (axMap1.Layers[handle].Name == "Example Point")
            {
                thishandle = handle;
                result = 1;
            }
            handle++;
        }
        if (result > 0)
        {
            e.layerHandle = thishandle;
        }
    }