示例#1
0
        private void PasteControlClick(object sender, EventArgs e)
        {
            GUIControl newControl = GUIControl.GetFromClipBoard();

            if (newControl != null)
            {
                newControl.Name     = Factory.AGSEditor.GetFirstAvailableScriptName(newControl.ControlType);
                newControl.ZOrder   = _gui.Controls.Count;
                newControl.ID       = _gui.Controls.Count;
                newControl.MemberOf = null;

                newControl.Left = _state.WindowXToGUI(_currentMouseX);
                newControl.Top  = _state.WindowYToGUI(_currentMouseY);
                _gui.Controls.Add(newControl);
                _selected.Clear();
                _selectedControl = newControl;
                _selected.Add(newControl);


                RaiseOnControlsChanged();
                Factory.AGSEditor.CurrentGame.NotifyClientsGUIControlAddedOrRemoved(_gui, newControl);

                Factory.GUIController.SetPropertyGridObject(newControl);

                bgPanel.Invalidate();
                UpdateCursorImage();
                // Revert back to Select cursor
                OnCommandClick(Components.GuiComponent.MODE_SELECT_CONTROLS);
            }
        }
示例#2
0
文件: GUIEditor.cs 项目: stee01/ags
        private void PasteControlClick(object sender, EventArgs e)
        {
            if (_gui.Controls.Count >= GUI.MAX_CONTROLS_PER_GUI)
            {
                Factory.GUIController.ShowMessage("You already have the maximum number of controls on this GUI, and cannot add any more.", MessageBoxIcon.Warning);
                return;
            }
            GUIControl newControl = GUIControl.GetFromClipBoard();

            if (newControl != null)
            {
                newControl.Name     = Factory.AGSEditor.GetFirstAvailableScriptName(newControl.ControlType);
                newControl.ZOrder   = _gui.Controls.Count;
                newControl.ID       = _gui.Controls.Count;
                newControl.MemberOf = null;

                newControl.Left = _currentMouseX / Factory.AGSEditor.CurrentGame.GUIScaleFactor;
                newControl.Top  = _currentMouseY / Factory.AGSEditor.CurrentGame.GUIScaleFactor;
                _gui.Controls.Add(newControl);
                _selected.Clear();
                _selectedControl = newControl;
                _selected.Add(newControl);


                RaiseOnControlsChanged();
                Factory.AGSEditor.CurrentGame.NotifyClientsGUIControlAddedOrRemoved(_gui, newControl);

                Factory.GUIController.SetPropertyGridObject(newControl);

                bgPanel.Invalidate();
                UpdateCursorImage();
                // Revert back to Select cursor
                OnCommandClick(Components.GuiComponent.MODE_SELECT_CONTROLS);
            }
        }