//------------------------------------------------------- void Bdup_Click(object sender, EventArgs e) { //throw new NotImplementedException(); selectionArea sel = getSelection(); if (sel.length == 1) { dup(sel.start); } }
//------------------------------------------------------- void Bdel_Click(object sender, EventArgs e) { //throw new NotImplementedException(); int idx = this.SelectedIndex; selectionArea sel = getSelection(); if (sel.length > 0) { for (int i = sel.end; i >= sel.start; i--) { _list.RemoveAt(i); this.Items.RemoveAt(i); } OnItemChanged(new EventArgs()); } }
//------------------------------------------------------- void _box_SetClicked(object sender, EventArgs e) { if (_box == null) { return; } //throw new NotImplementedException(); selectionArea sel = getSelection(); if (sel.length <= 0) { return; } for (int i = sel.start; i <= sel.end; i++) { _list[i].Copy(_box.aerenderOpt, true); } OnItemChanged(new EventArgs()); }
//------------------------------------------------------- private void listDown() { selectionArea sel = getSelection(); int sLength = sel.length; if ((sel.start < 0) || (sLength <= 0) || (sel.end >= _list.Count - 1)) { return; } if (sLength == 1) { swapList(sel.start, sel.start + 1); sel.shift(1); this.SuspendLayout(); this.ClearSelected(); this.SetSelected(sel.start, true); this.ResumeLayout(); } else { aerenderOpt ao = new aerenderOpt(""); ao.Copy(_list[sel.end + 1]); object ob = this.Items[sel.end + 1]; this.SuspendLayout(); this.ClearSelected(); for (int i = sel.end; i >= sel.start; i--) { _list[i + 1].Copy(_list[i]); this.Items[i + 1] = this.Items[i]; } _list[sel.start].Copy(ao); this.Items[sel.start] = ob; sel.shift(1); for (int i = sel.start; i <= sel.end; i++) { this.SetSelected(i, true); } this.ResumeLayout(); } }
//------------------------------------------------------- private selectionArea getSelection() { selectionArea ret = new selectionArea(); ret.start = this.SelectedIndex; //選択範囲の処理 if (this.SelectedIndices.Count > 0) { ret.start = this.SelectedIndices[0]; ret.end = this.SelectedIndices[this.SelectedIndices.Count - 1]; if ((this.SelectedIndices.Count == ret.length) == false) { this.ClearSelected(); for (int i = ret.start; i <= ret.end; i++) { this.SetSelected(i, true); } } } return(ret); }
//------------------------------------------------------- protected override void OnSelectedIndexChanged(EventArgs e) { selectionArea sel = getSelection(); int cnt = this.Items.Count - 1; if (_box != null) { if (this.SelectedIndices.Count == 1) { _box.setOpt(_list[sel.start]); } else { _box.ClearALL(); } } else { _box.ClearALL(); } if (Bup != null) { if ((sel.start <= 0)) { Bup.Enabled = false; } else { Bup.Enabled = true; } } if (Bdown != null) { if ((sel.start < 0) || (sel.end >= cnt)) { Bdown.Enabled = false; } else { Bdown.Enabled = true; } } if (Bdel != null) { if ((sel.start < 0) || (sel.end > cnt)) { Bdel.Enabled = false; } else { Bdel.Enabled = true; } } if (Bdup != null) { if ((sel.start < 0) || (sel.end > cnt) || (sel.start != sel.end)) { Bdup.Enabled = false; } else { Bdup.Enabled = true; } } base.OnSelectedIndexChanged(e); }