Ejemplo n.º 1
0
        public MetroShell()
        {
            // This forces the initialization out of paint loop which speeds up how fast components show up
            BaseRenderer renderer = DevComponents.DotNetBar.Rendering.GlobalManager.Renderer;

            _QatFrequentCommands.IgnoreEvents = true;
            _QatFrequentCommands.AllowParentRemove = false;

            this.SetStyle(ControlStyles.AllPaintingInWmPaint
                  | ControlStyles.ResizeRedraw
                  | DisplayHelp.DoubleBufferFlag
                  | ControlStyles.UserPaint
                  | ControlStyles.Opaque
                  , true);
            _TabStrip = new MetroTabStrip();
            _TabStrip.Dock = DockStyle.Top;
            _TabStrip.Height = 32;
            _TabStrip.ItemAdded += new System.EventHandler(TabStripItemAdded);
            _TabStrip.LocalizeString += new DotNetBarManager.LocalizeStringEventHandler(TabStripLocalizeString);
            _TabStrip.ItemClick += new System.EventHandler(TabStripItemClick);
            _TabStrip.ButtonCheckedChanged += new EventHandler(TabStripButtonCheckedChanged);
            _TabStrip.TitleTextMarkupLinkClick += new MarkupLinkClickEventHandler(TabStripTitleTextMarkupLinkClick);
            this.Controls.Add(_TabStrip);
            this.TabStop = false;
            this.DockPadding.Bottom = DefaultBottomDockPadding;

            StyleManager.Register(this);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Called when right-mouse button is pressed over MetroTabStrip
 /// </summary>
 /// <param name="metroStrip">Reference to MetroTabStrip object.</param>
 internal void OnTabStripRightClick(MetroTabStrip metroStrip, int x, int y)
 {
     if (!DisplayCustomizeContextMenu)
         return;
     BaseItem item = metroStrip.HitTest(x, y);
     if (item != null && item.CanCustomize && !item.SystemItem)
     {
         ShowCustomizeContextMenu(item, true);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates new instance of the class and initializes it with the parent RibbonStrip control.
        /// </summary>
        /// <param name="parent">Reference to parent RibbonStrip control</param>
        public MetroStripContainerItem(MetroTabStrip parent)
        {
            _TabStrip = parent;

            // We contain other controls
            m_IsContainer = true;
            this.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;

            _ItemContainer = new MetroTabItemContainer();
            _ItemContainer.ContainerControl = parent;
            _ItemContainer.GlobalItem = false;
            _ItemContainer.WrapItems = false;
            _ItemContainer.EventHeight = false;
            _ItemContainer.UseMoreItemsButton = false;
            _ItemContainer.Stretch = true;
            _ItemContainer.Displayed = true;
            _ItemContainer.SystemContainer = true;
            _ItemContainer.PaddingTop = 0;
            _ItemContainer.PaddingBottom = 0;
            _ItemContainer.PaddingLeft = 0;
            _ItemContainer.ItemSpacing = 1;

            _CaptionContainer = new CaptionItemContainer();
            _CaptionContainer.ContainerControl = parent;
            _CaptionContainer.GlobalItem = false;
            _CaptionContainer.WrapItems = false;
            _CaptionContainer.EventHeight = false;
            _CaptionContainer.EqualButtonSize = false;
            _CaptionContainer.ToolbarItemsAlign = eContainerVerticalAlignment.Top;
            _CaptionContainer.UseMoreItemsButton = false;
            _CaptionContainer.Stretch = true;
            _CaptionContainer.Displayed = true;
            _CaptionContainer.SystemContainer = true;
            _CaptionContainer.PaddingBottom = 0;
            _CaptionContainer.PaddingTop = 0;
            _CaptionContainer.PaddingLeft = 6;
            _CaptionContainer.ItemSpacing = 1;
            _CaptionContainer.TrackSubItemsImageSize = false;
            _CaptionContainer.ItemAdded += new EventHandler(this.CaptionContainerNewItemAdded);
            this.SubItems.Add(_CaptionContainer);
            this.SubItems.Add(_ItemContainer);

            _Settings = new ButtonItem("sysSettingsButton");
            _Settings.Text=DefaultSettingsButtonText;
            //_Settings.HotTrackingStyle = eHotTrackingStyle.None;
            _Settings.ItemAlignment = eItemAlignment.Far;
            _Settings.Click += new EventHandler(SettingsButtonClick);
            _Settings.SetSystemItem(true);
            _Settings.CanCustomize = false;
            _CaptionContainer.SubItems.Add(_Settings);

            _Help = new ButtonItem("sysHelpButton");
            _Help.Text = DefaultHelpButtonText;
            _Help.SetSystemItem(true);
            _Help.CanCustomize = false;
            //_Help.HotTrackingStyle = eHotTrackingStyle.None;
            _Help.ItemAlignment = eItemAlignment.Far;
            _Help.Click += new EventHandler(HelpButtonClick);
            _CaptionContainer.SubItems.Add(_Help);

            SystemCaptionItem sc = new SystemCaptionItem();
            sc.RestoreEnabled = false;
            sc.IsSystemIcon = false;
            sc.ItemAlignment = eItemAlignment.Far;
            _CaptionContainer.SubItems.Add(sc);
            _SystemCaptionItem = sc;
        }