Example #1
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            #region 把相同分组的数据
            Canvas c = this.Parent as Canvas;
            foreach (UIElement ctl in c.Children)
            {
                BPRadioBtn rb = null;
                try
                {
                    rb = ctl as BPRadioBtn;
                    if (rb == null)
                    {
                        continue;
                    }
                }
                catch
                {
                    continue;
                }

                if (rb.GroupName == this.GroupName)
                {
                    rb.Foreground = new SolidColorBrush(Colors.Blue);
                }
                else
                {
                    rb.Foreground = new SolidColorBrush(Colors.Black);
                }
            }
            #endregion 把相同分组的按钮设置成一组颜色.

            mousePosition     = e.GetPosition(null);
            trackingMouseMove = true;
            base.OnMouseLeftButtonDown(e);
        }
Example #2
0
        public void DoDeleteIt()
        {
            Canvas c   = this.Parent as Canvas;
            string ids = "";

            foreach (UIElement uiCtl in c.Children)
            {
                Control ctl = uiCtl as Control;
                if (ctl == null)
                {
                    continue;
                }

                if (ctl.Name.Contains(this.GroupName))
                {
                    ids += "@" + ctl.Name;
                }
            }

            string[] strs = ids.Split('@');
            foreach (string str in strs)
            {
                foreach (UIElement uiCtl in c.Children)
                {
                    Control ctl = uiCtl as Control;
                    if (ctl == null)
                    {
                        continue;
                    }

                    if (ctl.Name == str)
                    {
                        c.Children.Remove(ctl);
                        BPRadioBtn eleBtn = ctl as BPRadioBtn;
                        eleBtn.IsDelete = true;
                        break;
                    }
                }
            }
            c.Children.Remove(this);
            Glo.currEle   = null;
            this.IsDelete = true;
        }