public void SelectByPoint(int left, int top) { IMLCharGenEdit cgedit = (IMLCharGenEdit)CGObject; string strItemID; cgedit.EditSelectionRemove(""); foreach (CGBaseItem item in CGItems) { item.isSelected = false; } if (CurrGroupID != null && CurrGroupID != string.Empty) { cgedit.EditSelectionAdd(CurrGroupID, "lime", 0); } cgedit.EditItemGetByPoint(m_strCurrGroupID, left, top, out strItemID); cgedit.EditSelectionAdd(strItemID, "red", 0); foreach (CGBaseItem item in CGItems) { if (item.ID == strItemID) { item.isSelected = true; } } if (ItemSelected != null) { ItemSelected(this, new EventArgs()); } }
public void SelectItems(string[] ids, bool clearSelection) { IMLCharGenEdit cgedit = (IMLCharGenEdit)CGObject; if (clearSelection) { cgedit.EditSelectionRemove(""); foreach (CGBaseItem item in CGItems) { item.isSelected = false; } } if (CurrGroupID != null && CurrGroupID != string.Empty) { cgedit.EditSelectionAdd(CurrGroupID, "lime", 0); } foreach (string id in ids) { cgedit.EditSelectionAdd(id, "red", 0); foreach (CGBaseItem item in CGItems) { if (item.ID == id) { item.isSelected = true; } } } if (ItemSelected != null) { ItemSelected(this, new EventArgs()); } }
public void SelectByRectangle(int left, int top, int right, int bottom) { IMLCharGenEdit cgedit = (IMLCharGenEdit)CGObject; string strItemIDs; cgedit.EditSelectionRemove(""); foreach (CGBaseItem item in CGItems) { item.isSelected = false; } if (!string.IsNullOrEmpty(CurrGroupID)) { cgedit.EditSelectionAdd(CurrGroupID, "lime", 0); } cgedit.EditItemsGetByRect(CurrGroupID, left, top, right, bottom, out strItemIDs); if (!string.IsNullOrEmpty(strItemIDs)) { string[] strSplit = strItemIDs.Split(','); foreach (string s in strSplit) { string strTrimmed = s.Trim(); cgedit.EditSelectionAdd(strTrimmed, "red", 0); foreach (CGBaseItem item in CGItems) { if (item.ID == strTrimmed) { item.isSelected = true; //break; } } } } if (ItemSelected != null) { ItemSelected(this, new EventArgs()); } }