示例#1
0
        private void OnLayerSelected(object sender, EventArgs e)
        {
            Button bnSender = sender as Button;

            // *** single selection
            if (SingleSelection)
            {
                // -> unselect other buttons
                foreach (Control ctrl in Controls)
                {
                    Button bt = ctrl as Button;
                    if (bt != bnSender)
                    {
                        LayerItem btItem = bt.Tag as LayerItem;
                        if (btItem.Selected)
                        {
                            btItem.Selected = false;
                            bt.Image        = TryGenerateLayerImage(btItem.Layer, szButtons, btItem.Selected);
                        }
                    }
                }
            }
            // ***
            LayerItem lItem    = bnSender.Tag as LayerItem;
            bool      selected = !lItem.Selected;

            bnSender.Image = TryGenerateLayerImage(lItem.Layer, szButtons, selected);
            bnSender.Tag   = new LayerItem(lItem.Layer, selected);
            LayerSelected?.Invoke(this, e);
        }
示例#2
0
        private void onLayerSelected(object sender, EventArgs e)
        {
            Button    bn       = sender as Button;
            LayerItem lItem    = bn.Tag as LayerItem;
            bool      selected = !lItem.Selected;

            bn.Image = LayerToImage.Draw(lItem.Layer, _bProperties, _contHeight, szButtons, selected);
            bn.Tag   = new LayerItem(lItem.Layer, selected);
            LayerSelected(this, e);
        }
示例#3
0
        private void onLayerSelected(object sender, EventArgs e)
        {
            Button bnSender = sender as Button;

            // *** single selection
            if (SingleSelection)
            {
                // -> unselect other buttons
                foreach (Control ctrl in Controls)
                {
                    Button bt = ctrl as Button;
                    if (bt != bnSender)
                    {
                        LayerItem btItem = bt.Tag as LayerItem;
                        if (btItem.Selected)
                        {
                            btItem.Selected = false;
                            bt.Image        = LayerToImage.Draw(
                                btItem.Layer, _packable, _contHeight, szButtons, btItem.Selected
                                , Show3D ? LayerToImage.eGraphMode.GRAPH_3D : LayerToImage.eGraphMode.GRAPH_2D);
                        }
                    }
                }
            }
            // ***
            LayerItem lItem    = bnSender.Tag as LayerItem;
            bool      selected = !lItem.Selected;

            bnSender.Image = LayerToImage.Draw(
                lItem.Layer, _packable, _contHeight, szButtons, selected
                , Show3D ? LayerToImage.eGraphMode.GRAPH_3D : LayerToImage.eGraphMode.GRAPH_2D);
            bnSender.Tag = new LayerItem(lItem.Layer, selected);
            if (null != LayerSelected)
            {
                LayerSelected(this, e);
            }
        }