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()); } }