private void BtnGroup_Click(object sender, EventArgs e) { if (shapes.Count(shape => shape.isSelected) > 1) { clsGroup group = new clsGroup(); for (int i = 0; i < shapes.Count; i++) { if (shapes[i].isSelected) { group.add(shapes[i]); shapes.RemoveAt(i--); } } group.isSelected = true; shapes.Add(group); redraw(); pnlPaint.Focus(); } }
//選擇不同TreeView的Node發生之事件 protected void tvGroup_SelectedNodeChanged(object sender, EventArgs e) { string[] paths = tvGroup.SelectedNode.ValuePath.Split('/'); clsGroup GroupUtil = new clsGroup(); int departmentIndex = paths.Length; string NamePaths = ""; string ValuePaths = ""; //組合單位路徑 int num = 1; //判斷是什麼頁面使用本頁面 switch (modle) { //編輯模式頁面進來 case "EditMLASCourse": foreach (string path in paths) { string GroupID = ""; string GroupName = ""; if (num < paths.Length - 1) { GroupID = path.Split('_')[0]; GroupName = clsGroup.GetGroupNameByGroupIDAndGroupClassifyName(GroupID, clsGroupNode.GroupClassification_Other); } else if (num < paths.Length) { GroupID = path.Split('_')[0]; GroupName = clsGroup.GetGroupNameByGroupIDAndGroupClassifyName(GroupID, clsGroupNode.GroupClassification_SchoolGroup); } else { GroupID = path.Split('_')[0]; GroupName = clsGroup.GetGroupNameByGroupIDAndGroupClassifyName(GroupID, clsGroupNode.GroupClassification_ClassGroup); } NamePaths += GroupName + "/"; ValuePaths += GroupID + "/"; num++; } NamePaths = NamePaths.Remove(NamePaths.Length - 1); ValuePaths = ValuePaths.Remove(ValuePaths.Length - 1); //將所選擇到的Node存入hfNodeValue Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ClickScript", "opener.document.getElementById('ctl00_cphContentArea_tbSelectGroupPath').value = '" + NamePaths + "';opener.document.getElementById('ctl00_cphContentArea_hfBelongUnitID').value = '" + ValuePaths + "';window.close();", true); break; case "MLASSelectUser": foreach (string path in paths) { string GroupID = ""; string GroupName = ""; if (num < paths.Length - 1) { GroupID = path.Split('_')[0]; GroupName = clsGroup.GetGroupNameByGroupIDAndGroupClassifyName(GroupID, clsGroupNode.GroupClassification_Other); } else if (num < paths.Length) { GroupID = path.Split('_')[0]; GroupName = clsGroup.GetGroupNameByGroupIDAndGroupClassifyName(GroupID, clsGroupNode.GroupClassification_SchoolGroup); } else { GroupID = path.Split('_')[0]; GroupName = clsGroup.GetGroupNameByGroupIDAndGroupClassifyName(GroupID, clsGroupNode.GroupClassification_ClassGroup); } NamePaths += GroupName + "/"; ValuePaths += GroupID + "/"; num++; } NamePaths = NamePaths.Remove(NamePaths.Length - 1); ValuePaths = ValuePaths.Remove(ValuePaths.Length - 1); //將所選擇到的Node存入hfNodeValue Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ClickScript", "opener.document.getElementById('ctl00_cphContentArea_tbSelectGroupPath').value = '" + NamePaths + "';opener.document.getElementById('ctl00_cphContentArea_hfBelongUnitID').value = '" + ValuePaths + "';window.close();", true); break; } }