Ejemplo n.º 1
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 RibbonStripContainerItem(RibbonStrip parent)
        {
            m_RibbonStrip = parent;

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

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

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

            SystemCaptionItem sc = new SystemCaptionItem();
            sc.RestoreEnabled = false;
            sc.IsSystemIcon = false;
            sc.ItemAlignment = eItemAlignment.Far;
            m_CaptionContainer.SubItems.Add(sc);
            m_SystemCaptionItem = sc;

        }
Ejemplo n.º 2
0
        public OfficeForm()
            : base()
        {
            // This forces the initialization out of paint loop which speeds up how fast components show up
            BaseRenderer renderer = Rendering.GlobalManager.Renderer;

            m_BorderWidth = SystemInformation.Border3DSize.Width + NativeFunctions.BorderMultiplierFactor;
            this.DockPadding.All = 0;

            m_Caption = new GenericItemContainer();
            m_Caption.GlobalItem = false;
            m_Caption.ContainerControl = this;
            m_Caption.WrapItems = false;
            m_Caption.EventHeight = false;
            m_Caption.UseMoreItemsButton = false;
            m_Caption.Stretch = true;
            m_Caption.Displayed = true;
            m_Caption.SystemContainer = true;
            m_Caption.PaddingTop = 0;
            m_Caption.PaddingBottom = 0;
            m_Caption.PaddingLeft = 2;
            m_Caption.ItemSpacing = 1;
            m_Caption.SetOwner(this);
            m_Caption.Style = eDotNetBarStyle.StyleManagerControlled;
            m_Caption.ToolbarItemsAlign = eContainerVerticalAlignment.Top;

            m_SystemIcon = new SystemCaptionItem();
            m_SystemIcon.GlobalItem = false;
            m_SystemIcon.Enabled = false;
            m_Caption.SubItems.Add(m_SystemIcon);
            m_SystemIcon.IsSystemIcon = true;
            m_SystemIcon.Icon = this.Icon;

            m_TitleLabel = CreateTitleLabel();
            m_Caption.SubItems.Add(m_TitleLabel);
            
            CreateAdditionalCaptionItems(m_Caption);

            m_SystemButtons = new SystemCaptionItem();
            m_SystemButtons.GlobalItem = false;
            //m_SystemButtons.ItemAlignment = eItemAlignment.Far;
            m_SystemButtons.Click += new EventHandler(SystemButtons_Click);
            m_SystemButtons.MouseEnter += new EventHandler(SystemButtons_MouseEnter);
            m_Caption.SubItems.Add(m_SystemButtons);
        }
Ejemplo n.º 3
0
        protected override void OnStyleChanged()
        {
            if (this.EffectiveStyle == eDotNetBarStyle.Office2010 || this.EffectiveStyle == eDotNetBarStyle.Metro)
            {
                if (_WindowIcon == null)
                {
                    _IconSeparator = new Separator("sys_caption_separator");
                    _IconSeparator.SetSystemItem(true);
                    m_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;
                    m_CaptionContainer.SubItems._Add(_WindowIcon, 0);
                }
            }
            else if (this.EffectiveStyle == eDotNetBarStyle.Windows7)
            {
                if (_WindowIcon == null)
                {
                    _IconSeparator = new Separator("sys_caption_separator");
                    _IconSeparator.FixedSize = new Size(3, 12);
                    _IconSeparator.SetSystemItem(true);
                    m_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;
                    m_CaptionContainer.SubItems._Add(_WindowIcon, 0);
                }
            }
            else if(_WindowIcon!=null)
            {
                if (m_CaptionContainer.SubItems.Contains(_WindowIcon))
                    m_CaptionContainer.SubItems._Remove(_WindowIcon);
                _WindowIcon.Dispose();
                _WindowIcon = null;
                if (m_CaptionContainer.SubItems.Contains(_IconSeparator))
                    m_CaptionContainer.SubItems._Remove(_IconSeparator);
                _IconSeparator.Dispose();
                _IconSeparator = null;
            }

            base.OnStyleChanged();
        }
Ejemplo n.º 4
0
 public static SystemCaptionItemPainter CreateSystemCaptionItemPainter(SystemCaptionItem item)
 {
     eDotNetBarStyle effectiveStyle = item.EffectiveStyle;
     if (effectiveStyle == eDotNetBarStyle.Office2010)
         return Office2010SystemCaptionItemPainter;
     if (effectiveStyle == eDotNetBarStyle.Metro)
         return MetroCaptionItemPainter;
     if (BarFunctions.IsOffice2007Style(effectiveStyle))
         return Office2007SystemCaptionItemPainter;
     return null;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates new instance of the class and initializes it with default values.
 /// </summary>
 /// <param name="g">Reference to Graphics object.</param>
 /// <param name="item">Reference to item being rendered.</param>
 /// <param name="glassEnabled">Indicates whether Vista Glass effect is enabled.</param>
 public SystemCaptionItemRendererEventArgs(Graphics g, SystemCaptionItem item, bool glassEnabled)
 {
     this.Graphics = g;
     this.SystemCaptionItem = item;
     this.GlassEnabled = glassEnabled;
 }