コード例 #1
0
 public void SetElementsSelection(DuhringLineControl elementCtrl, ModifierKey modKey)
 {
     if (modKey == ModifierKey.Ctrl)
     {
         elementCtrl.IsSelected = !elementCtrl.IsSelected;
         this.baseIndex         = this.GetIndexOfElement(elementCtrl);
     }
     else if (modKey == ModifierKey.Shift)
     {
         int currentIdx = this.GetIndexOfElement(elementCtrl);
         if (currentIdx >= 0 && this.baseIndex >= 0)
         {
             this.UnselectElements();
             int minIdx = System.Math.Min(currentIdx, this.baseIndex);
             int maxIdx = System.Math.Max(currentIdx, this.baseIndex);
             this.SetElementsSelection(minIdx, maxIdx);
         }
     }
     else
     {
         this.UnselectElements();
         elementCtrl.IsSelected = true;
         this.baseIndex         = this.GetIndexOfElement(elementCtrl);
     }
 }
コード例 #2
0
        public void DeleteSelectedElements()
        {
            IEnumerator e = this.GetSelectedIndexes().GetEnumerator();

            while (e.MoveNext())
            {
                DuhringLineControl element = this.GetElement((int)e.Current);
                this.DuhringLinesCache.RemoveDuhringLine(element.DuhringLine);
            }
        }
コード例 #3
0
        private void SetElementsSelection(int minIdx, int maxIdx)
        {
            DuhringLineControl element = null;

            for (int i = 0; i < this.panel.Controls.Count; i++)
            {
                if (i >= minIdx && i <= maxIdx)
                {
                    element            = this.panel.Controls[i] as DuhringLineControl;
                    element.IsSelected = true;
                }
            }
        }
コード例 #4
0
        private void UpdateTheUI(INumericFormat iNumericFormat, DuhringLinesCache duhringLinesCache)
        {
            this.panel.Controls.Clear();
            IEnumerator e = duhringLinesCache.DuhringLines.GetEnumerator();
            int         i = 0;

            while (e.MoveNext())
            {
                DuhringLine        duhringLine = (DuhringLine)e.Current;
                DuhringLineControl ctrl        = new DuhringLineControl(iNumericFormat, duhringLine, true);
                ctrl.Location = new Point(0, ctrl.Height * i++);
                this.panel.Controls.Add(ctrl);
            }
        }
コード例 #5
0
        private int GetIndexOfElement(DuhringLineControl elementCtrl)
        {
            int index = -1;

            for (int i = 0; i < this.panel.Controls.Count - 1; i++)
            {
                if ((this.panel.Controls[i] as DuhringLineControl).Equals(elementCtrl))
                {
                    index = i;
                    break;
                }
            }
            return(index);
        }