示例#1
0
        private void Rectangle_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Brush brush = (((System.Windows.Shapes.Rectangle)e.Source).Fill);
            int   id    = -1;

            for (int i = 0; i < list.Count; i++)
            {
                if (brush == list[i].brush)
                {
                    id = i;
                }
            }
            if (id != -1)
            {
                RenderRule     rule = list[id].rule;
                SymbolSelector form = new SymbolSelector(rule);
                if (form.ShowDialog() == true)
                {
                    list[id].brush = form.brush;
                    list[id].rule  = form.rule;
                    dataGrid.Items.Refresh();
                }
            }
            //int id = Convert.ToInt32(((System.Windows.Shapes.Rectangle)e.Source).Name);
        }
示例#2
0
        private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int id = dataGrid.SelectedIndex;

            if (id != -1)
            {
                RenderRule rule = list[id].rule;
                switch (rule.geometrysymbolizer.sign)
                {
                case SymbolizerType.POINT:
                    PointSymbolSelector form_point = new PointSymbolSelector(rule);
                    if (form_point.ShowDialog() == true)
                    {
                        list[id].brush = form_point.brush;
                        list[id].rule  = form_point.rule;
                        dataGrid.Items.Refresh();
                    }
                    break;

                case SymbolizerType.POLYGON:
                    PolygonSymbolSelector form_polygon = new PolygonSymbolSelector(rule);
                    if (form_polygon.ShowDialog() == true)
                    {
                        list[id].brush = form_polygon.brush;
                        list[id].rule  = form_polygon.rule;
                        dataGrid.Items.Refresh();
                    }
                    break;

                default:
                    SymbolSelector form = new SymbolSelector(rule);
                    if (form.ShowDialog() == true)
                    {
                        list[id].brush = form.brush;
                        list[id].rule  = form.rule;
                        dataGrid.Items.Refresh();
                    }
                    break;
                }
            }
            //int id = Convert.ToInt32(((System.Windows.Shapes.Rectangle)e.Source).Name);
        }