コード例 #1
0
        public static void SetEnabled(string tabName, string panelUID, string buttonUID, bool enabled)
        {
            RibbonTabCollection oTabs = Autodesk.Windows.ComponentManager.Ribbon.Tabs;

            foreach (RibbonTab oTab in oTabs)
            {
                if (oTab.Title == tabName)
                {
                    RibbonPanelCollection bPans = oTab.Panels;

                    foreach (RibbonPanel oPanel in bPans)
                    {
                        if (oPanel.UID == panelUID)
                        {
                            foreach (RibbonItem item in oPanel.Source.Items)
                            {
                                if (item.UID == buttonUID)
                                {
                                    item.IsEnabled = enabled;
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }
コード例 #2
0
        public static void modifyRibbon(string strTabName, string strPanelUID, string strButtonUID, bool bEnable)
        {
            RibbonTabCollection oTabs = Autodesk.Windows.ComponentManager.Ribbon.Tabs;

            foreach (RibbonTab oTab in oTabs)
            {
                if (oTab.Title == strTabName)
                {
                    RibbonPanelCollection bPans = oTab.Panels;

                    foreach (RibbonPanel oPanel in bPans)
                    {
                        if (oPanel.UID == strPanelUID)
                        {
                            foreach (RibbonItem item in oPanel.Source.Items)
                            {
                                if (item.UID == strButtonUID)
                                {
                                    item.IsEnabled = bEnable;
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates a new Ribbon control
        /// </summary>
        public Ribbon()
        {
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, false);
            DoubleBuffered = true;
            Dock = DockStyle.Top;

            Tabs = new RibbonTabCollection(this);
            _contexts = new RibbonContextCollection(this);

            TabsMargin = new Padding(12, 24 + 2, 20, 0);
            TabTextMargin = new Padding(4, 2, 4, 2);
            TabsPadding = new Padding(8, 5, 8, 3);
            TabContentMargin = new Padding(1, 0, 1, 2);
            PanelPadding = new Padding(3);
            PanelMargin = new Padding(3, 2, 3, 15);
            PanelSpacing = 3;
            ItemPadding = new Padding(1, 0, 1, 0);
            ItemMargin = new Padding(4, 2, 4, 2);
            TabSpacing = 6;
            DropDownMargin = new Padding(2);
            _renderer = new RibbonProfessionalRenderer();
            _orbVisible = true;
            OrbDropDown = new RibbonOrbDropDown(this);
            QuickAcessToolbar = new RibbonQuickAccessToolbar(this);
            QuickAccessVisible = true;
        }
コード例 #4
0
ファイル: Ribbon.cs プロジェクト: okyereadugyamfi/softlogik
        /// <summary>
        /// Creates a new Ribbon control
        /// </summary>
        public Ribbon()
        {
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, false);
            DoubleBuffered = true;
            Dock = DockStyle.Top;

            _tabs = new RibbonTabCollection(this);
            _contexts = new RibbonContextCollection(this);

            _tabsMargin = new Padding(48, 2, 20, 0);
            _tabTextMargin = new Padding(4, 2, 4, 2);
            _tabsPadding = new Padding(8, 5, 8, 3);
            _tabContentMargin = new Padding(1, 0, 1, 2);
            _panelPadding = new Padding(3);
            _panelMargin = new Padding(3, 2, 3, 15);
            _panelSpacing = 3;
            _itemPadding = new Padding(1, 0, 1, 0);
            _itemMargin = new Padding(4, 2, 4, 2);
            _tabSpacing = 6;
            _dropDownMargin = new Padding(2);
            _renderer = new RibbonProfessionalRenderer();
        }
コード例 #5
0
ファイル: Ribbon.cs プロジェクト: JoeyScarr/word-commandmap
        /// <summary>
        /// Creates a new Ribbon control
        /// </summary>
        public Ribbon()
        {
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, false);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            Dock = DockStyle.Top;

            _tabs = new RibbonTabCollection(this);
            _contexts = new RibbonContextCollection(this);

            _tabsMargin = new Padding(12, 24 + 2, 20, 0);
            _tabTextMargin = new Padding(4, 2, 4, 2);
            _tabsPadding = new Padding(8, 5, 8, 3);
            _tabContentMargin = new Padding(1, 0, 1, 2);
            _panelPadding = new Padding(3);
            _panelMargin = new Padding(0, 2, 0, 15);
            _panelSpacing = DefaultPanelSpacing;
            _itemPadding = new Padding(1, 0, 1, 0);
            _itemMargin = new Padding(4, 2, 4, 2);
            _tabSpacing = DefaultTabSpacing;
            _dropDownMargin = new Padding(2);
            _renderer = new RibbonProfessionalRenderer();
            _orbVisible = true;
            _orbDropDown = new RibbonOrbDropDown(this);
            _quickAcessToolbar = new RibbonQuickAccessToolbar(this);
            //_quickAcessVisible = true;
            _MinimizeButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Minimize);
            _MaximizeRestoreButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Maximize);
            _CloseButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Close);

            _MinimizeButton.SetOwner(this);
            _MaximizeRestoreButton.SetOwner(this);
            _CloseButton.SetOwner(this);
            _CaptionBarVisible = true;

            Font = SystemFonts.CaptionFont;

            BorderMode = RibbonWindowMode.NonClientAreaGlass;

            _minimized = false;
            _expanded = true;

             RibbonPopupManager.PopupRegistered += OnPopupRegistered;
             RibbonPopupManager.PopupUnRegistered += OnPopupUnregistered;
        }
コード例 #6
0
 /// <summary>
 /// Creates a new RibbonTabContext
 /// </summary>
 /// <param name="Ribbon">Ribbon that owns the context</param>
 public RibbonContext(Ribbon owner)
 {
     _tabs = new RibbonTabCollection(owner);
 }
コード例 #7
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            if (_subscribed)
            {
                Autodesk.Windows.ComponentManager.ItemExecuted
                    -= OnItemExecuted;

                _subscribed = false;
            }
            else
            {
                RibbonTabCollection tabs
                    = ComponentManager.Ribbon.Tabs;

                foreach (RibbonTab tab in tabs)
                {
                    Debug.Print("  {0} {1} '{2}'", tab,
                                tab.GetType().Name, tab.AutomationName);

                    if (tab.KeyTip == null)
                    {
                        // This tab is user defined.

                        foreach (var panel in tab.Panels)
                        {
                            // Cannot convert type 'Autodesk.Windows.RibbonPanel'
                            // to 'Autodesk.Revit.UI.RibbonPanel' via a reference
                            // conversion, boxing conversion, unboxing conversion,
                            // wrapping conversion, or null type conversion.
                            //
                            //Autodesk.Revit.UI.RibbonPanel rp
                            //  = panel as Autodesk.Revit.UI.RibbonPanel;

                            Autodesk.Windows.RibbonPanel rp
                                = panel as Autodesk.Windows.RibbonPanel;

                            Debug.Print("    {0} {1}",
                                        panel.ToString(), panel.GetType().Name);

                            foreach (var item in panel.Source.Items)
                            {
                                Autodesk.Windows.RibbonItem ri = item
                                                                 as Autodesk.Windows.RibbonItem;

                                string automationName = ri.AutomationName;

                                Debug.Print("      {0} {1} '{2}' {3}",
                                            item.ToString(), item.GetType().Name,
                                            automationName, ri.Cookie);
                            }
                        }
                    }
                }

                Autodesk.Windows.ComponentManager.ItemExecuted
                    += OnItemExecuted;

                _subscribed = true;
            }
            return(Result.Succeeded);
        }
コード例 #8
0
		/// <summary>
		/// Creates a new Ribbon control
		/// </summary>
		public Ribbon()
		{
			SetStyle(ControlStyles.ResizeRedraw, true);
			SetStyle(ControlStyles.Selectable, false);
			SetStyle(ControlStyles.UserPaint, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

			Dock = DockStyle.Top;

			_tabs = new RibbonTabCollection(this);
			_contexts = new RibbonContextCollection(this);

			_orbsPadding = new Padding(8, 5, 8, 3);
			_tabsPadding = new Padding(8, 5, 8, 3);
			_tabsMargin = new Padding(12, 24 + 2, 20, 0);
			_tabTextMargin = new Padding(4, 2, 4, 2);

			_tabContentMargin = new Padding(1, 0, 1, 2);
			_panelPadding = new Padding(3);
			_panelMargin = new Padding(3, 2, 3, 15);
			_panelMoreMargin = new Padding(0, 0, 1, 1);
			_panelSpacing = DefaultPanelSpacing;
			_itemPadding = new Padding(1, 0, 1, 0);
			_itemMargin = new Padding(4, 2, 4, 2);
			_itemImageToTextSpacing = 3;
			_tabSpacing = DefaultTabSpacing;
			_dropDownMargin = new Padding(2);
			_renderer = new RibbonProfessionalRenderer(this);
			_orbVisible = true;
			_orbDropDown = new RibbonOrbDropDown(this);
			_quickAcessToolbar = new RibbonQuickAccessToolbar(this);
			//_quickAcessVisible = true;
			_MinimizeButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Minimize);
			_MaximizeRestoreButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Maximize);
			_CloseButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Close);
			_layoutHelper = new LayoutHelper(this);

			_MinimizeButton.SetOwner(this);
			_MaximizeRestoreButton.SetOwner(this);
			_CloseButton.SetOwner(this);
			_CaptionBarVisible = true;

			Font = SystemFonts.CaptionFont;

			BorderMode = RibbonWindowMode.NonClientAreaGlass;

			_minimized = false;
			_expanded = true;
			_enabled = true;

			RibbonPopupManager.PopupRegistered += OnPopupRegistered;
			RibbonPopupManager.PopupUnRegistered += OnPopupUnregistered;
			Control parent = null;
			this.ParentChanged += (o1, e1) =>
			{
				if (parent != null)
				{
					parent.KeyUp -= Ribbon_KeyUp;
					parent.KeyDown -= parent_KeyDown;
				}

				parent = this.Parent;

				Application.AddMessageFilter(this);

				if (parent is Form)
				{
					var form = parent as Form;

					form.KeyPreview = true;

					form.FormClosing += (o, e) =>
						{
							Application.RemoveMessageFilter(this);
						};
				}
				if (parent != null)
				{
					parent.KeyDown += parent_KeyDown;
					parent.KeyUp += Ribbon_KeyUp;
				}
			};
		}
コード例 #9
0
        /// <summary>
        /// Initializes a new <see cref="RibbonTabCollectionUIAdapter"/>
        /// </summary>
        /// <param name="tabs">Tabs collection represented by the ui adapter</param>
        public RibbonTabsCollectionUIAdapter(RibbonTabCollection tabs)
        {
            Guard.ArgumentNotNull(tabs, "tabs");

            this.tabs = tabs;
        }
コード例 #10
0
 /// <summary>
 ///     Creates a new RibbonTabContext
 /// </summary>
 /// <param name="Ribbon">Ribbon that owns the context</param>
 public RibbonContext(Ribbon owner)
 {
     _tabs = new RibbonTabCollection(owner);
 }
コード例 #11
0
ファイル: Ribbon.cs プロジェクト: sduxiaowu/NineLineScore
        /// <summary>
        /// Creates a new Ribbon control
        /// </summary>
        public Ribbon()
        {
            
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, false);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            //DoubleBuffered = true;
            Dock = DockStyle.Top;

            _tabs = new RibbonTabCollection(this);
            _contexts = new RibbonContextCollection(this);

            _tabsMargin = new Padding(12, 24 + 2, 20, 0);
            _tabTextMargin = new Padding(4, 2, 4, 2);
            _tabsPadding = new Padding(8, 5, 8, 3);
            _tabContentMargin = new Padding(1, 0, 1, 2);
            _panelPadding = new Padding(3);
            _panelMargin = new Padding(3, 2, 3, 15);
            _panelSpacing = 3;
            _itemPadding = new Padding(1, 0, 1, 0);
            _itemMargin = new Padding(4, 2, 4, 2);
            _tabSpacing = 6;
            _dropDownMargin = new Padding(2);
            _renderer = new RibbonProfessionalRenderer();
            _orbVisible = true;
            _orbDropDown = new RibbonOrbDropDown(this);
            _quickAcessToolbar = new RibbonQuickAccessToolbar(this);
            _quickAcessVisible = true;
            _MinimizeButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Minimize);
            _MaximizeRestoreButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Maximize);
            _CloseButton = new RibbonCaptionButton(RibbonCaptionButton.CaptionButton.Close);

            _MinimizeButton.SetOwner(this);
            _MaximizeRestoreButton.SetOwner(this);
            _CloseButton.SetOwner(this);

            Font = SystemFonts.CaptionFont;

            BorderMode = RibbonWindowMode.NonClientAreaGlass;
            Disposed += new EventHandler(Ribbon_Disposed);

        }