protected override void LoadExample()
        {
            // store a reference to the original toolbar builder
            if (originalDiagramToolbarsBuilder == null)
            {
                originalDiagramToolbarsBuilder = Form.CommandBarsManager.ToolbarsBuilder;
            }

            // create the custom buttom command if not already craated
            if (customDiagramButtonCommand == null)
            {
                customDiagramButtonCommand = new NCustomDiagramButtonCommand();
                Form.CommandBarsManager.Commander.Commands.Add(customDiagramButtonCommand);
            }

            NControlHelper.BeginUpdate(Form.CommandBarsManager.ParentControl);

            // replace the toolbar builder with a custom one
            Form.CommandBarsManager.ToolbarsBuilder = new NCustomDiagramToolbarsBuilder();

            // recreate the command bars. Since we have replaced the toolbars builder,
            // this will add the new command in the toolbars
            Form.CommandBarsManager.Recreate();

            NControlHelper.EndUpdate(Form.CommandBarsManager.ParentControl, true);
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                try
                {
                    NControlHelper.BeginUpdate(Form.CommandBarsManager.ParentControl);

                    Form.CommandBarsManager.Commander.Commands.Remove(customDiagramButtonCommand);
                    Form.CommandBarsManager.ToolbarsBuilder = originalDiagramToolbarsBuilder;
                    Form.CommandBarsManager.Recreate();
                    NControlHelper.EndUpdate(Form.CommandBarsManager.ParentControl, true);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }

                if (components != null)
                {
                    components.Dispose();
                }
            }

            base.Dispose(disposing);
        }
Beispiel #3
0
        protected override void LoadExample()
        {
            // store a reference to the original toolbar builder
            if (originalDiagramContextMenuBuilder == null)
            {
                originalDiagramContextMenuBuilder = Form.CommandBarsManager.ContextMenuBuilder;
            }

            // create the custom buttom command if not already craated
            if (customDiagramButtonCommand == null)
            {
                customDiagramButtonCommand = new NCustomContextMenuDiagramButtonCommand();
                Form.CommandBarsManager.Commander.Commands.Add(customDiagramButtonCommand);
            }

            NControlHelper.BeginUpdate(Form.CommandBarsManager.ParentControl);

            // replace the context menu builder with a custom one
            Form.CommandBarsManager.ContextMenuBuilder = new NCustomDiagramContextMenuBuilder();

            // recreate the command bars. This is needed because custom commands
            // need to be exported to Nevron UI command contexts also
            Form.CommandBarsManager.Recreate();

            Form.View.DelegateBuildContextMenu = BuildContextMenu;


            NControlHelper.EndUpdate(Form.CommandBarsManager.ParentControl, true);
        }
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            if (m.Msg != NWMConstants.WM_MOUSEACTIVATE)
            {
                return;
            }

            Control c = NControlHelper.ControlFromPoint(Control.MousePosition);

            if (c is NDecoratorBase)
            {
                m_Properties.SelectedObject = c;
            }

            Control decorator = NControlHelper.GetParentOfType(c, typeof(NDecoratorBase));

            if (decorator != null)
            {
                m_Properties.SelectedObject = decorator;
            }
        }