private void PlaceAddFromEnd(ControlBase value) { IndexVisibleList.Clear(); ListControls.Add(value); if (TotalControlHeight > Size.Height) { vScrollBarAdv1.Enabled = true; int currentHeigth = 0; for (int i = ListControls.Count - 1; i >= 0; --i) { if (currentHeigth < Size.Height) { IndexVisibleList.Insert(0, i); EnableControl(ListControls[i]); ListControls[i].Location = new Point(1, Size.Height - currentHeigth - ListControls[i].Size.Height); currentHeigth += ListControls[i].Size.Height; } else { DisableControl(ListControls[i]); } } this.vScrollBarAdv1.Maximum = (int)((double)(TotalControlHeight * vScrollBarAdv1.LargeChange) / (double)vScrollBarAdv1.ClientSize.Height); this.vScrollBarAdv1.Value = vScrollBarAdv1.Maximum - vScrollBarAdv1.LargeChange + 1; } else { vScrollBarAdv1.Enabled = false; int currentHeigth = 0; for (int i = 0; i < ListControls.Count; ++i) { if (currentHeigth < Size.Height) { IndexVisibleList.Add(i); EnableControl(ListControls[i]); ListControls[i].Location = new Point(1, currentHeigth); currentHeigth += ListControls[i].Size.Height; } else { DisableControl(ListControls[i]); } } } SelectIndex = ListControls.Count - 1; Update(); }
private void PlaceAddFromFirst(ControlBase value) { if (TotalControlHeight > Size.Height) { vScrollBarAdv1.Value = vScrollBarAdv1.Minimum; vScrollBarAdv1.Enabled = true; } IndexVisibleList.Clear(); int currentHeigth = value.Size.Height; for (int i = 0; i < ListControls.Count; ++i) { if (currentHeigth < Size.Height) { IndexVisibleList.Add(i + 1); EnableControl(ListControls[i]); ListControls[i].Location = new Point(1, currentHeigth); currentHeigth += ListControls[i].Size.Height; } else { DisableControl(ListControls[i]); } } value.Location = new Point(1, 0); EnableControl(value); ListControls.Insert(0, value); IndexVisibleList.Insert(0, 0); if (TotalControlHeight > Size.Height) { this.vScrollBarAdv1.Maximum = (int)((double)(TotalControlHeight * vScrollBarAdv1.LargeChange) / (double)vScrollBarAdv1.ClientSize.Height); this.vScrollBarAdv1.Value = 1; } selectIndex = SelectIndex + 1; SelectIndex = 0; vScrollBarAdv1.Update(); Update(); }
void Controls_DragOver(object sender, DragEventArgs e) { Console.Write("Controls_DragOver\n"); ControlBase myCtrl = (ControlBase)sender; ControlBase myDragCtrl = ListControls[SelectIndex]; DragIndex = ListControls.IndexOf(myCtrl); if (myCtrl != myDragCtrl) { if (LastDragY < e.Y) { ((ControlBase)sender).ShowBorderForDragOver(DevComponents.DotNetBar.eBorderSide.Bottom); ++DragIndex; } else if (LastDragY > e.Y) { ((ControlBase)sender).ShowBorderForDragOver(DevComponents.DotNetBar.eBorderSide.Top); } } LastDragY = e.Y; lastDragOver = myCtrl; }
void OnGUI() { GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3((float)1.0 * Screen.width / 1280, (float)1.0 * Screen.height / 800, 1.0f)); GUI.skin = currentSkin; GUI.depth = 0; if (isVideoOptionsActive) { GUILayout.BeginArea(new Rect((1280 / 2) - 360, (800 / 2) - 250, 720, 500), "VIDEO OPTIONS", GUI.skin.window); GUI.Label(new Rect(20, 50, 400, 30), "Select Your Screen Resolution"); selectedResolution = ListControls.ResListbox(new Rect(20, 100, 400, 380), reses, currentSkins, selectedResolution, resList); GUI.Label(new Rect(440, 100, 250, 35), "Current Screen Resolution"); GUI.Label(new Rect(440, 130, 200, 35), Screen.width.ToString() + " X " + Screen.height.ToString()); //prints the selected resolution, if there none selected, show an empty string GUI.Label(new Rect(440, 165, 250, 35), "Selected Screen Resolution"); if (selectedResolution.x == 0 || selectedResolution.y == 0) { GUI.Label(new Rect(440, 195, 200, 35), ""); } else { GUI.Label(new Rect(440, 195, 200, 35), selectedResolution.x.ToString() + " X " + selectedResolution.y.ToString()); } wantFullScreen = GUI.Toggle(new Rect(440, 240, 180, 20), wantFullScreen, "Full Screen?"); GUI.Label(new Rect(440, 280, 180, 35), "Graphics Quality"); qualitySliderValue = GUI.HorizontalSlider(new Rect(440, 310, 250, 35), qualitySliderValue, 1, 3); intQualitySliderValue = (int)qualitySliderValue; GUI.Label(new Rect(440, 320, 180, 35), selectedQuality); if (GUI.Button(new Rect(440, 405, 250, 35), "Apply Changes")) { if (selectedResolution != Vector2.zero) { if (selectedResolution.x > 639 && selectedResolution.y > 479) { Screen.SetResolution((int)selectedResolution.x, (int)selectedResolution.y, wantFullScreen); } } QualitySettings.currentLevel = levelOfQuality; } //check if it was called from the main menu or the pause menu, to know what window should it return to if (GUI.Button(new Rect(440, 445, 250, 35), "Back")) { isVideoOptionsActive = false; if (!wasFromMenu) { (GetComponent("PauseMenuGUI") as PauseMenuGUI).isPauseMenuActive = true; wasFromMenu = false; } else { (GetComponent("MainMenuGUI") as MainMenuGUI).isMainMenuActive = true; wasFromMenu = false; } (GetComponent("VideoOptionsGUI") as VideoOptionsGUI).enabled = false; } GUILayout.EndArea(); } }
void OnGUI() { //this file is very long and may be confusing without proper separation and organization, so thats why each dialog and function of the GUI is separated by comments GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3((float)1.0 * Screen.width / 1280, (float)1.0 * Screen.height / 800, 1.0f)); GUI.skin = currentSkins[0]; GUI.depth = 5; GUI.skin = currentSkins[1]; GUI.skin = currentSkins[0]; /* * GUILayout.BeginArea(new Rect(10, 0, 1260, 60), "", GUI.skin.box); * // MAIN MENU GUI ---------------------------------------------- * // this the gui on top of the level editor which has the basic functions and modes of the editor * /* * if (GUI.Button(new Rect(0, 15, 65, 30), "NEW")) * { * GameManager.currentLevel = ""; * GameManager.levelName = ""; * if (root.transform.childCount != 0) * { * foreach (Transform child in root) * { * Destroy(child.gameObject); * } * } * } * * if (GUI.Button(new Rect(70, 15, 65, 30), "OPEN")) * { * GameManager.isLoadDialogActive = true; * tempLevelName = GameManager.currentLevel; * } * * if (GUI.Button(new Rect(140, 15, 65, 30), "SAVE")) * { * if (GameManager.currentLevel != "") * { * (GetComponent("LevelLoader") as LevelLoader).SaveLevel(); * } * else * { * GameManager.isSaveDialogActive = true; * } * } * * if (GUI.Button(new Rect(210, 15, 90, 30), "SAVE AS")) * { * GameManager.levelName = ""; * GameManager.isSaveDialogActive = true; * } * * if (GUI.Button(new Rect(305, 15, 65, 30), "EXIT")) * { * Application.LoadLevel("MainMenu"); * } * * if (GameManager.edModes == GameManager.EditorModes.MOVE || GameManager.edModes == GameManager.EditorModes.ROTATE) * { * if (GUI.Button(new Rect(570, 15, 80, 30), "DELETE")) * { * if (GameManager.SelectedObject != null) * { * Destroy(GameManager.SelectedObject.gameObject); * GameManager.SelectedObject = null; * } * } * } * * if (GUI.Button(new Rect(655, 15, 80, 30), "INSERT")) * { * GameManager.edModes = GameManager.EditorModes.INSERT; * } * * if (GUI.Button(new Rect(740, 15, 65, 30), "MOVE")) * { * //sets some initial values for the coordinate editor * GameManager.edModes = GameManager.EditorModes.MOVE; * if (GameManager.SelectedObject != null) * { * GameManager.coordEdX = GameManager.SelectedObject.position.x.ToString(); * GameManager.coordEdY = GameManager.SelectedObject.position.y.ToString(); * GameManager.coordEdZ = GameManager.SelectedObject.position.z.ToString(); * } * else * { * GameManager.coordEdX = "0"; * GameManager.coordEdY = "0"; * GameManager.coordEdZ = "0"; * } * } * * if (GUI.Button(new Rect(810, 15, 80, 30), "ROTATE")) * { * //sets some initial values for the coordinate editor * GameManager.edModes = GameManager.EditorModes.ROTATE; * if (GameManager.SelectedObject != null) * { * GameManager.coordEdX = GameManager.SelectedObject.rotation.eulerAngles.x.ToString(); * GameManager.coordEdY = GameManager.SelectedObject.rotation.eulerAngles.y.ToString(); * GameManager.coordEdZ = GameManager.SelectedObject.rotation.eulerAngles.z.ToString(); * } * else * { * GameManager.coordEdX = "0"; * GameManager.coordEdY = "0"; * GameManager.coordEdZ = "0"; * } * } * * GameManager.is2DMode = GUI.Toggle(new Rect(375, 15, 75, 30),GameManager.is2DMode,"2D/3D"); * if(GameManager.edModes == GameManager.EditorModes.MOVE || GameManager.edModes == GameManager.EditorModes.INSERT ) * { * GameManager.lockToGrid = GUI.Toggle(new Rect(455, 15, 115, 30),GameManager.lockToGrid,"Grid Snap"); * } * else * { * GameManager.lockToGrid = GUI.Toggle(new Rect(455, 15, 115, 30),GameManager.lockToGrid,"Deg Snap"); * } * GUI.Label(new Rect(895, 15, 150, 50), "MODE:" + GameManager.edModes.ToString()); * GUILayout.EndArea(); * */ // MAIN MENU GUI END ---------------------------------------------- // OBJECT LIBRARY GUI ---------------------------------------------- if (GameManager.edModes == GameManager.EditorModes.INSERT) { GUILayout.BeginArea(new Rect(1030, 20, 240, 580), "LIBRARY", GUI.skin.window); //this calls the object library listbox, check ListControls class to know more about it if (prefabListNames != null && buttonImgs != null) { ListControls.EditorListbox(new Rect(5, 55, 230, 510), prefabListNames, currentSkins, buttonImgs); } else { GUI.Label(new Rect(5, 55, 230, 510), "NO OBJECTS IN LIBRARY"); } GUILayout.EndArea(); } // OBJECT LIBRARY GUI END ---------------------------------------------- // POSITION/ROTATION EDITOR GUI ---------------------------------------------- else if (GameManager.edModes == GameManager.EditorModes.MOVE || GameManager.edModes == GameManager.EditorModes.ROTATE) { if (GameManager.SelectedObject != null) { if (GameManager.edModes == GameManager.EditorModes.MOVE) { GUILayout.BeginArea(new Rect(1120, 500, 150, 290), "Position", GUI.skin.window); GUI.Label(new Rect(10, 50, 40, 40), "X: "); GameManager.coordEdX = GUI.TextField(new Rect(30, 45, 100, 40), GameManager.coordEdX, 6); GUI.Label(new Rect(10, 90, 40, 40), "Y: "); GameManager.coordEdY = GUI.TextField(new Rect(30, 85, 100, 40), GameManager.coordEdY, 6); if (!GameManager.is2DMode) { GUI.Label(new Rect(10, 130, 40, 40), "Z: "); GameManager.coordEdZ = GUI.TextField(new Rect(30, 125, 100, 40), GameManager.coordEdZ, 6); } } else if (GameManager.edModes == GameManager.EditorModes.ROTATE) { GUILayout.BeginArea(new Rect(1120, 500, 150, 290), "Rotation", GUI.skin.window); if (!GameManager.is2DMode) { GUI.Label(new Rect(10, 50, 40, 40), "X: "); GameManager.coordEdX = GUI.TextField(new Rect(30, 45, 100, 40), GameManager.coordEdX, 6); GUI.Label(new Rect(10, 90, 40, 40), "Y: "); GameManager.coordEdY = GUI.TextField(new Rect(30, 85, 100, 40), GameManager.coordEdY, 6); GUI.Label(new Rect(10, 130, 40, 40), "Z: "); GameManager.coordEdZ = GUI.TextField(new Rect(30, 125, 100, 40), GameManager.coordEdZ, 6); } else { GUI.Label(new Rect(10, 130, 40, 40), "Z: "); GameManager.coordEdZ = GUI.TextField(new Rect(30, 125, 100, 40), GameManager.coordEdZ, 6); } } //here regular expresions are used, to prevent the user types characters instead of numbers, only numbers and the minus sign are allowed //the replacement is done on the fly , so theres no way to type characters in the coordinate text fields GameManager.coordEdX = Regex.Replace(GameManager.coordEdX, @"[^\d\.@-]", String.Empty); GameManager.coordEdY = Regex.Replace(GameManager.coordEdY, @"[^\d\.@-]", String.Empty); GameManager.coordEdZ = Regex.Replace(GameManager.coordEdZ, @"[^\d\.@-]", String.Empty); if (GUI.Button(new Rect(30, 170, 80, 30), "APPLY")) { Vector3 tempvec = Vector3.zero; //here regular expressions are used again just to make sure theres no characters in the coordinate editor //as the typed numbers will later be converted to actual floats, having a character in here would cause a big crash GameManager.coordEdX = Regex.Replace(GameManager.coordEdX, @"[^\d\.@-]", String.Empty); GameManager.coordEdY = Regex.Replace(GameManager.coordEdY, @"[^\d\.@-]", String.Empty); GameManager.coordEdZ = Regex.Replace(GameManager.coordEdZ, @"[^\d\.@-]", String.Empty); //convert the values to floats if (float.TryParse(GameManager.coordEdX, out tempvec.x)) { tempvec.x = float.Parse(GameManager.coordEdX); } if (float.TryParse(GameManager.coordEdY, out tempvec.y)) { tempvec.y = float.Parse(GameManager.coordEdY); } if (float.TryParse(GameManager.coordEdZ, out tempvec.z)) { tempvec.z = float.Parse(GameManager.coordEdZ); } //apply the values to the selected object if (GameManager.edModes == GameManager.EditorModes.MOVE) { GameManager.SelectedObject.transform.position = tempvec; } else if (GameManager.edModes == GameManager.EditorModes.ROTATE) { Quaternion tempQuat = Quaternion.identity; tempQuat.eulerAngles = tempvec; GameManager.SelectedObject.transform.rotation = tempQuat; } } if (GUI.Button(new Rect(30, 210, 80, 30), "ROUND")) { Vector3 tempvec = Vector3.zero; //here regular expressions are used once again just to make sure theres no characters in the coordinate editor //as the typed numbers will later be converted to actual floats, having a character in here would cause a big crash GameManager.coordEdX = Regex.Replace(GameManager.coordEdX, @"[^\d\.@-]", String.Empty); GameManager.coordEdY = Regex.Replace(GameManager.coordEdY, @"[^\d\.@-]", String.Empty); GameManager.coordEdZ = Regex.Replace(GameManager.coordEdZ, @"[^\d\.@-]", String.Empty); if (float.TryParse(GameManager.coordEdX, out tempvec.x)) { tempvec.x = float.Parse(GameManager.coordEdX); } if (float.TryParse(GameManager.coordEdY, out tempvec.y)) { tempvec.y = float.Parse(GameManager.coordEdY); } if (float.TryParse(GameManager.coordEdZ, out tempvec.z)) { tempvec.z = float.Parse(GameManager.coordEdZ); } tempvec.x = Mathf.Round(tempvec.x); tempvec.y = Mathf.Round(tempvec.y); tempvec.z = Mathf.Round(tempvec.z); //this sets the values only to the coordinate editor text fields , you need to press apply to actually apply the changes if (GameManager.edModes == GameManager.EditorModes.MOVE) { GameManager.coordEdX = tempvec.x.ToString(); GameManager.coordEdY = tempvec.y.ToString(); if (!GameManager.is2DMode) { GameManager.coordEdZ = tempvec.z.ToString(); } } else if (GameManager.edModes == GameManager.EditorModes.ROTATE) { GameManager.coordEdZ = tempvec.z.ToString(); if (!GameManager.is2DMode) { GameManager.coordEdX = tempvec.x.ToString(); GameManager.coordEdY = tempvec.y.ToString(); } } } //the transforms are screwed beyond repair or just simply want to return everything to factory state?. use RESET! if (GUI.Button(new Rect(30, 250, 80, 30), "RESET")) { if (GameManager.edModes == GameManager.EditorModes.MOVE) { GameManager.coordEdX = "0"; GameManager.coordEdY = "0"; if (!GameManager.is2DMode) { GameManager.coordEdZ = "0"; } } else if (GameManager.edModes == GameManager.EditorModes.ROTATE) { GameManager.coordEdZ = "0"; if (!GameManager.is2DMode) { GameManager.coordEdX = "0"; GameManager.coordEdY = "0"; } } } GUILayout.EndArea(); } } //POSITION/ROTATION EDITOR GUI END -------------------------------------------- //// HELP POPUP ------------ GUI.skin = currentSkins[1]; GUILayout.BeginArea(new Rect(20, 80, 600, 700), "", GUI.skin.box); if (showHelp) { if (GameManager.is2DMode) { GUI.Label(new Rect(0, 0, 600, 50), " CONTROLS"); GUI.Label(new Rect(0, 50, 600, 50), "WASDQE to move the camera"); GUI.Label(new Rect(0, 100, 600, 50), "use Left Mouse Button to SELECT and INSERT objects into the level"); GUI.Label(new Rect(0, 150, 600, 50), "use Left Mouse Button to MOVE or ROTATE objects"); GUI.Label(new Rect(0, 200, 600, 50), "you can enter the position and rotation values manually"); GUI.Label(new Rect(0, 250, 600, 50), "in the coord editor or choose Round or Reset and then press apply"); GUI.Label(new Rect(0, 300, 600, 50), "Press Delete or R key to remove the Selected Object"); GUI.Label(new Rect(0, 350, 600, 50), "Level will be saved in 2d or 3d mode depending on the current active mode"); GUI.Label(new Rect(0, 400, 600, 50), "Press H to hide help"); } else { GUI.Label(new Rect(0, 0, 600, 50), " CONTROLS"); GUI.Label(new Rect(0, 50, 600, 50), "WASD to move the camera"); GUI.Label(new Rect(0, 100, 600, 50), "Press Right Mouse Button"); GUI.Label(new Rect(0, 150, 600, 50), "or ALT to pan the view with the Mouse"); GUI.Label(new Rect(0, 200, 600, 50), "use Left Mouse Button to SELECT and INSERT objects into the level"); GUI.Label(new Rect(0, 250, 600, 50), "if Mouse is over the Grid they will appear there"); GUI.Label(new Rect(0, 300, 600, 50), "otherwise objects will appear at position of the mouse in mid air"); GUI.Label(new Rect(0, 350, 600, 50), "use Left Mouse Button to MOVE or ROTATE objects"); GUI.Label(new Rect(0, 400, 600, 50), "you can enter the position and rotation values manually"); GUI.Label(new Rect(0, 450, 600, 50), "in the coord editor or choose Round or Reset and then press apply"); GUI.Label(new Rect(0, 500, 600, 50), "Press R key to remove the Selected Object"); GUI.Label(new Rect(0, 550, 600, 50), "Level will be saved in 2d or 3d mode depending on the current active mode"); GUI.Label(new Rect(0, 600, 600, 50), "Press H to hide help"); } } else { //GUI.Label(new Rect(0, 0, 600, 50), "Press H to show Controls"); } GUILayout.EndArea(); //// HELP POPUP END------------- GUI.skin = currentSkins[0]; //// SAVE AS DIALOG ------------ if (GameManager.isSaveDialogActive) { GUILayout.BeginArea(new Rect((1280 / 2) - 300, (800 / 2) - 90, 600, 180), "Save As Level", GUI.skin.window); GameManager.levelName = GUI.TextField(new Rect(50, 50, 500, 50), GameManager.levelName, 25); if (GUI.Button(new Rect(50, 110, 200, 30), "Save New Level")) { //use the name typed in the text field, add it the .xml extension and the path to the levels folder and call the SaveLevel function if (GameManager.levelName != "") { GameManager.currentLevel = GameManager.levelsPath.FullName + "/" + GameManager.levelName + ".xml"; (GetComponent("LevelLoader") as LevelLoader).SaveLevel(); } GameManager.isSaveDialogActive = false; } if (GUI.Button(new Rect(350, 110, 200, 30), "CANCEL")) { GameManager.levelName = ""; GameManager.isSaveDialogActive = false; } GUILayout.EndArea(); } //// SAVE AS DIALOG END ------------ //// OPEN LEVEL DIALOG ---------- if (GameManager.isLoadDialogActive) { GUILayout.BeginArea(new Rect((1280 / 2) - 400, (800 / 2) - 300, 800, 600), "Level Selection", GUI.skin.window); //same as with the level selection dialog, //checks if the level folder exists, then retrieve all the xml files in there // and extract the file names from the path to display in the list if (Directory.Exists(GameManager.levelsPath.FullName)) { fileNames = System.IO.Directory.GetFiles(GameManager.levelsPath.FullName, "*.xml"); if (fileNames != null) { levelNames = new string[fileNames.Length]; for (int i = 0; i < fileNames.Length; i++) { levelNames[i] = Path.GetFileName(fileNames[i]); } } } ListControls.LevelListbox(new Rect(25, 50, 800 - 50, 410), levelNames, fileNames, currentSkins); GUI.Label(new Rect(25, 500, 750, 50), "Selected Level: " + Path.GetFileName(GameManager.currentLevel)); if (GUI.Button(new Rect((400 - 75) - 300, 600 - 65, 150, 50), "Cancel")) { GameManager.currentLevel = tempLevelName; GameManager.isLoadDialogActive = false; } if (GUI.Button(new Rect((400 - 75) + 300, 600 - 65, 150, 50), "Load Level")) { if (GameManager.currentLevel != "") { (GetComponent("LevelLoader") as LevelLoader).LoadLevel(); } GameManager.isLoadDialogActive = false; } GUILayout.EndArea(); } //// OPEN LEVEL DIALOG END ---------- ////CURRENT LEVEL INDICATOR --------- if (GameManager.currentLevel != "") { GUI.Label(new Rect(0, 750, 900, 50), "Current Level: " + Path.GetFileName(GameManager.currentLevel)); } else { // GUI.Label(new Rect(0, 750, 900, 50), "Current Level: UNSAVED LEVEL" ); } ////CURRENT LEVEL INDICATOR END --------- }
public void RemoveAt(int Index) { if ((Index < 0) || (Index >= ListControls.Count)) { return; } int lastTotalHeight = TotalControlHeight; TotalControlHeight -= ListControls[Index].Size.Height; if (TotalControlHeight < vScrollBarAdv1.ClientSize.Height) { this.vScrollBarAdv1.Maximum = 0; this.vScrollBarAdv1.Value = 0; vScrollBarAdv1.Enabled = false; } else { int lastMax = this.vScrollBarAdv1.Maximum; int lastValue = this.vScrollBarAdv1.Value; int lastheightdiff = lastTotalHeight - this.vScrollBarAdv1.ClientSize.Height; int heightdiff = TotalControlHeight - this.vScrollBarAdv1.ClientSize.Height; int lastvalueMax = lastMax - this.vScrollBarAdv1.LargeChange + 1; int currentMax = (int)((double)(TotalControlHeight * vScrollBarAdv1.LargeChange) / (double)vScrollBarAdv1.ClientSize.Height); int valueMax = currentMax - this.vScrollBarAdv1.LargeChange + 1; int currentvalue = (int)((double)(lastheightdiff * valueMax * lastValue) / (lastvalueMax * heightdiff)); this.vScrollBarAdv1.Maximum = currentMax; if (this.vScrollBarAdv1.Value <= 0) { this.vScrollBarAdv1.Value = 1; } else if (this.vScrollBarAdv1.Value > valueMax) { this.vScrollBarAdv1.Value = valueMax; } else { this.vScrollBarAdv1.Value = currentvalue; } } ListControls[Index].MouseDown -= new MouseEventHandler(this.Controls_MouseDown); ListControls[Index].QueryContinueDrag -= new System.Windows.Forms.QueryContinueDragEventHandler(this.Controls_QueryContinueDrag); ListControls[Index].DragOver -= new System.Windows.Forms.DragEventHandler(this.Controls_DragOver); ListControls[Index].DragLeave -= new EventHandler(Controls_DragLeave); ListControls[Index].DragDrop -= new DragEventHandler(Controls_DragDrop); Controls.Remove(ListControls[Index]); ListControls.RemoveAt(Index); DoScrollAction(); if (SelectIndex >= ListControls.Count) { SelectIndex = ListControls.Count - 1; } else if (SelectIndex < 0) { SelectIndex = 0; } else { SelectIndex = SelectIndex; } Update(); }
// public void InsertAt(int Index, ControlBase value) // { // } public void Remove(ControlBase value) { int index = ListControls.IndexOf(value); RemoveAt(index); }