示例#1
0
        /// <summary>
        /// Called when the context menu button is selected.
        /// </summary>
        public virtual void editProperties()
        {
            try
            {
                // If it is already showing, bring it to the front.
                if (null != _propertyGridForm)
                {
                    _propertyGridForm.Show();
                    _propertyGridForm.Activate();
                    return;
                }
                else
                {
                    string persistentName = "CanvasPropertyGrid";

                    // Make the property grid.
                    System.Windows.Forms.PropertyGrid grid = new System.Windows.Forms.PropertyGrid();
                    grid.Dock                  = System.Windows.Forms.DockStyle.Fill;
                    grid.SelectedObject        = this.PropertyGridObject;
                    grid.PropertyValueChanged += this._propertyValueChanged;

                    // Make new container form, add property grid, and show it.
                    _propertyGridForm = new CadKit.Persistence.Form();
                    _propertyGridForm.PersistentName = persistentName;
                    _propertyGridForm.Controls.Add(grid);
                    CadKit.Tools.ToolWindow.configure(_propertyGridForm, this.FindForm(), "Edit OpenGL Canvas", true);
                    _propertyGridForm.FormClosed += this._propertyGridClosed;
                    _propertyGridForm.Show();
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 1108970309: {0}\n{1}", e.Message, e.StackTrace);
            }
        }
示例#2
0
        /// <summary>
        /// Called when the context menu button is selected.
        /// </summary>
        public virtual void editBackgroundColor()
        {
            try
            {
                if (null != _colorEditorForm)
                {
                    _colorEditorForm.Show();
                    _colorEditorForm.Activate();
                    return;
                }

                else
                {
                    string persistentName = "CanvasColorWheel";

                    // Make the color editor.
                    CadKit.Color.Editor editor = new CadKit.Color.Editor();
                    editor.PersistentName = persistentName;
                    editor.Dock           = System.Windows.Forms.DockStyle.Fill;
                    editor.Color          = this.BackColor;
                    editor.ColorChanged  += this._colorChanged;
                    editor.ColorEditDone += this._colorDoneChanging;

                    // Make new container form.
                    _colorEditorForm = new CadKit.Persistence.Form();
                    _colorEditorForm.PersistentName = persistentName;
                    _colorEditorForm.Controls.Add(editor);
                    CadKit.Tools.ToolWindow.configure(_colorEditorForm, this.FindForm(), "Edit Background", true);
                    _colorEditorForm.FormClosed += this._colorEditorClosed;
                    _colorEditorForm.Show();
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 6369872130: {0}\n{1}", e.Message, e.StackTrace);
            }
        }