Esempio n. 1
0
        private void frmMain2018_Load(object sender, EventArgs e)
        {
            Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\DevComponents\Ribbon");
            if (key != null)
            {
                try
                {
                    string layout = key.GetValue("RibbonPadCSLayout", "").ToString();
                    if (layout != "" && layout != null)
                    {
                        ribbonControl1.QatLayout = layout;
                    }
                }
                finally
                {
                    key.Close();
                }
            }

            ArrayList         items          = ribbonControl1.RibbonStrip.GetItems("", typeof(SystemCaptionItem));
            SystemCaptionItem sysFormButtons = (SystemCaptionItem)items[items.Count - 1];
            BaseItem          parentCont     = sysFormButtons.Parent;
            ButtonItem        buttonNotify   = new ButtonItem("buttonNotify");

            buttonNotify.Symbol        = "\uf0f3";
            buttonNotify.ItemAlignment = eItemAlignment.Far;
            buttonNotify.SymbolSize    = 12f;
            parentCont.SubItems.Insert(parentCont.SubItems.IndexOf(sysFormButtons), buttonNotify);
        }
Esempio n. 2
0
 protected override void OnStyleChanged()
 {
     eDotNetBarStyle effectiveStyle = this.EffectiveStyle;
     if (effectiveStyle == eDotNetBarStyle.Office2010)
     {
         if (_WindowIcon == null)
         {
             _IconSeparator = new Separator("sys_caption_separator");
             _IconSeparator.SetSystemItem(true);
             _IconSeparator.DesignTimeVisible = false;
             _IconSeparator.CanCustomize = false;
             _CaptionContainer.SubItems._Add(_IconSeparator, 0);
             _WindowIcon = new SystemCaptionItem();
             _WindowIcon.Name = "sys_caption_icon";
             _WindowIcon.Enabled = false;
             _WindowIcon.Style = this.Style;
             _WindowIcon.IsSystemIcon = true;
             _WindowIcon.DesignTimeVisible = false;
             _WindowIcon.CanCustomize = false;
             _WindowIcon.QueryIconOnPaint = true;
             _WindowIcon.MouseDown += WindowIconMouseDown;
             _WindowIcon.DoubleClick += WindowIconDoubleClick;
             _CaptionContainer.SubItems._Add(_WindowIcon, 0);
         }
     }
     else if (effectiveStyle == eDotNetBarStyle.Windows7)
     {
         if (_WindowIcon == null)
         {
             _IconSeparator = new Separator("sys_caption_separator");
             _IconSeparator.FixedSize = new Size(3, 12);
             _IconSeparator.SetSystemItem(true);
             _IconSeparator.DesignTimeVisible = false;
             _IconSeparator.CanCustomize = false;
             _CaptionContainer.SubItems._Add(_IconSeparator, 0);
             _WindowIcon = new SystemCaptionItem();
             _WindowIcon.Name = "sys_caption_icon";
             _WindowIcon.Enabled = false;
             _WindowIcon.Style = this.Style;
             _WindowIcon.IsSystemIcon = true;
             _WindowIcon.QueryIconOnPaint = true;
             _WindowIcon.DesignTimeVisible = false;
             _WindowIcon.CanCustomize = false;
             _WindowIcon.MouseDown += WindowIconMouseDown;
             _CaptionContainer.SubItems._Add(_WindowIcon, 0);
         }
     }
     else if (effectiveStyle == eDotNetBarStyle.Metro)
     {
         if (_WindowIcon == null)
         {
             _IconSeparator = new Separator("sys_caption_separator");
             _IconSeparator.FixedSize = new Size(3, 14);
             _IconSeparator.SetSystemItem(true);
             _IconSeparator.DesignTimeVisible = false;
             _IconSeparator.CanCustomize = false;
             _CaptionContainer.SubItems._Add(_IconSeparator, 0);
             _WindowIcon = new SystemCaptionItem();
             _WindowIcon.Name = "sys_caption_icon";
             _WindowIcon.Enabled = false;
             _WindowIcon.Style = this.Style;
             _WindowIcon.IsSystemIcon = true;
             _WindowIcon.DesignTimeVisible = false;
             _WindowIcon.CanCustomize = false;
             _WindowIcon.QueryIconOnPaint = true;
             _WindowIcon.MouseDown += WindowIconMouseDown;
             _WindowIcon.DoubleClick += WindowIconDoubleClick;
             _CaptionContainer.SubItems._Add(_WindowIcon, 0);
         }
     }
     else if (_WindowIcon != null)
     {
         if (_CaptionContainer.SubItems.Contains(_WindowIcon))
             _CaptionContainer.SubItems._Remove(_WindowIcon);
         _WindowIcon.MouseDown -= WindowIconMouseDown;
         _WindowIcon.DoubleClick -= WindowIconDoubleClick;
         _WindowIcon.Dispose();
         _WindowIcon = null;
         if (_CaptionContainer.SubItems.Contains(_IconSeparator))
             _CaptionContainer.SubItems._Remove(_IconSeparator);
         _IconSeparator.Dispose();
         _IconSeparator = null;
     }
     base.OnStyleChanged();
 }
Esempio 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;
        }