private void RendererBox_MouseDown(object sender, MouseEventArgs e)
        {
            object item = null;

            for (int i = 0; i < RendererBox.Items.Count; i++)
            {
                Rectangle rect = RendererBox.GetItemRectangle(i);

                if (rect.Y <= e.Y && (rect.Y + rect.Height) >= e.Y)
                {
                    item = RendererBox.Items[i];
                    break;
                }
            }
            if (item == null)
            {
                return;
            }

            if (item is RendererItem)
            {
                if (e.X > 5 && e.X < 17)
                {
                    ((RendererItem)item).ShowLegend = !((RendererItem)item).ShowLegend;
                    ShowHideLegend(item as RendererItem);
                }
            }
        }
        private void btnProperties_Click(object sender, EventArgs e)
        {
            if (_selectedItem == null ||
                _selectedItem.Rule == null)
            {
                return;
            }

            SLDRenderer.Rule rule = _selectedItem.Rule;
            FormNewSLDRule   dlg  = new FormNewSLDRule(_layer, rule);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                RendererBox.Refresh();
            }
        }
        private void RendererBox_DoubleClick(object sender, EventArgs e)
        {
            object item = null;

            for (int i = 0; i < RendererBox.Items.Count; i++)
            {
                Rectangle rect = RendererBox.GetItemRectangle(i);
                if (rect.Y <= _mY && (rect.Y + rect.Height) >= _mY)
                {
                    item = RendererBox.Items[i];
                    break;
                }
            }
            if (item == null)
            {
                return;
            }

            if (item is LegendItem)
            {
                if (_mX > 20 && _mX < 50)
                {
                    ISymbol symbol = ((LegendItem)item).Item as ISymbol;
                    if (symbol != null)
                    {
                        FormSymbol dlg = new FormSymbol(symbol);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            int      index = RendererBox.Items.IndexOf(item);
                            RuleItem ritem = RendererBox.Items[index - 1] as RuleItem;
                            if (ritem != null)
                            {
                                ritem.Rule.Symbol       = dlg.Symbol;
                                ((LegendItem)item).Item = dlg.Symbol as ILegendItem;
                            }
                            RendererBox.Refresh();
                        }
                    }
                }
            }
        }
        private void RendererBox_DoubleClick(object sender, EventArgs e)
        {
            object item = null;

            for (int i = 0; i < RendererBox.Items.Count; i++)
            {
                Rectangle rect = RendererBox.GetItemRectangle(i);
                if (rect.Y <= _mY && (rect.Y + rect.Height) >= _mY)
                {
                    item = RendererBox.Items[i];
                    break;
                }
            }
            if (item == null)
            {
                return;
            }

            if (item is LegendItem && _renderer is ILegendGroup)
            {
                if (_mX > 20 && _mX < 50)
                {
                    ISymbol symbol = ((LegendItem)item).Item as ISymbol;
                    if (symbol != null)
                    {
                        FormSymbol dlg = new FormSymbol(symbol);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            ((ILegendGroup)_renderer).SetSymbol(((LegendItem)item).Item, dlg.Symbol);
                            ((LegendItem)item).Item = dlg.Symbol;
                            RendererBox.Refresh();
                        }
                    }
                }
            }
        }