/// <summary>
        /// Generates labels with specified positions
        /// </summary>
        private void btnOk_Click(object sender, EventArgs e)
        {
            // callback and wait cursor
            ICallback cBackOld = m_shapefile.GlobalCallback;
            Callback  cback    = new Callback();

            m_shapefile.GlobalCallback = cback;
            this.Enabled = false;
            this.Cursor  = Cursors.WaitCursor;

            MapWinGIS.Labels   lb          = m_shapefile.Labels;
            tkLabelPositioning positioning = get_LabelPositioning();

            lb.LineOrientation = (tkLineLabelOrientation)cboLineOrientation.SelectedIndex;

            try
            {
                // generation
                m_shapefile.GenerateLabels(-1, positioning, !chkLabelEveryPart.Checked);
                m_shapefile.Labels.SavingMode = tkSavingMode.modeXMLOverwrite;  // .lbl file should be updated

                ShpfileType type = Globals.ShapefileType2D(m_shapefile.ShapefileType);
                if (type == ShpfileType.SHP_POINT || type == ShpfileType.SHP_MULTIPOINT)
                {
                    if (optAlignBottomCenter.Checked)
                    {
                        m_alignment = tkLabelAlignment.laBottomCenter;
                    }
                    if (optAlignBottomLeft.Checked)
                    {
                        m_alignment = tkLabelAlignment.laBottomLeft;
                    }
                    if (optAlignBottomRight.Checked)
                    {
                        m_alignment = tkLabelAlignment.laBottomRight;
                    }
                    if (optAlignCenter.Checked)
                    {
                        m_alignment = tkLabelAlignment.laCenter;
                    }
                    if (optAlignCenterLeft.Checked)
                    {
                        m_alignment = tkLabelAlignment.laCenterLeft;
                    }
                    if (optAlignCenterRight.Checked)
                    {
                        m_alignment = tkLabelAlignment.laCenterRight;
                    }
                    if (optAlignTopCenter.Checked)
                    {
                        m_alignment = tkLabelAlignment.laTopCenter;
                    }
                    if (optAlignTopLeft.Checked)
                    {
                        m_alignment = tkLabelAlignment.laTopLeft;
                    }
                    if (optAlignTopRight.Checked)
                    {
                        m_alignment = tkLabelAlignment.laTopRight;
                    }
                }

                // updating references to categories
                if (lb.NumCategories > 0)
                {
                    for (int i = 0; i < lb.Count; i++)
                    {
                        MapWinGIS.Label label = lb.get_Label(i, 0);
                        label.Category = m_shapefile.get_ShapeCategory(i);
                    }
                }
            }
            finally
            {
                this.Enabled = true;
                this.Cursor  = Cursors.Default;
                cback.Clear();
                m_shapefile.GlobalCallback = cBackOld;
            }
        }