Exemplo n.º 1
0
        public override void DrawObject(ObjectInfoArgs e)
        {
            RibbonViewInfo vi = (RibbonViewInfo)((RibbonDrawInfo)e).ViewInfo;

            if (vi.Caption.Bounds.IsEmpty || !e.Cache.IsNeedDrawRect(vi.Caption.Bounds))
            {
                return;
            }

            //ObjectPainter.DrawObject(e.Cache, SkinElementPainter.Default, vi.Caption.GetCaptionDrawInfo());
            Rectangle captionRectangle = vi.Caption.Bounds;
            Brush     br = (vi.Ribbon as CustomRibbonControl).CaptionColor == Color.Empty ? Brushes.White : new SolidBrush((vi.Ribbon as CustomRibbonControl).CaptionColor);

            //
            e.Cache.Paint.FillRectangle(e.Cache.Graphics, br, vi.Caption.Bounds);
            if (vi.ShouldUseAppButtonContainerControlBkgnd && (vi.Caption as CustomRibbonCaptionViewInfo).CanGetFormButtonsBoundsEx)
            {
                Rectangle rect = (vi.Caption as CustomRibbonCaptionViewInfo).FormButtonBoundsEx;
                if (!rect.IsEmpty)
                {
                    ObjectPainter.DrawObject(e.Cache, SkinElementPainter.Default, (vi as CustomRibbonViewInfo).GetAppButtonContainerInfoEx(Rectangle.Inflate(rect, 1, 1)));
                }
            }
            DrawCaption(e);
            DrawPageHeaderBackground(e, true);
            if ((vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx != null)
            {
                (vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx.DrawIcon(e.Cache);
            }
            if ((vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx != null)
            {
                (vi.Caption as CustomRibbonCaptionViewInfo).FormPainterEx.DrawButtons(e.Cache, false);
            }
            DrawPageCategories(e as RibbonDrawInfo);
        }
 protected virtual void ReplaceUserControl()
 {
     if (HeaderControlNotNull)
     {
         HeaderControl.Parent  = RibbonControl;
         HeaderControl.Visible = true;
         RibbonViewInfo        vi          = RibbonControl.ViewInfo;
         RibbonCaptionViewInfo captionInfo = vi.Caption;
         int       height     = HeaderControl.Height <= 1 ? 17 : HeaderControl.Height;
         int       width      = HeaderControl.Width;
         Rectangle buttonRect = new Rectangle(captionInfo.ContentBounds.Right - width, captionInfo.ContentBounds.Y + (captionInfo.ContentBounds.Height - height) / 2, width, height);
         HeaderControl.Bounds = buttonRect;
     }
 }
Exemplo n.º 3
0
        private void DrawRibbonLogo(Graphics graphics)
        {
            if (Image == null)
            {
                return;
            }
            RibbonViewInfo ribbonViewInfo = RibbonControl.ViewInfo;

            if (ribbonViewInfo == null)
            {
                return;
            }
            RibbonPanelViewInfo panelViewInfo = ribbonViewInfo.Panel;

            if (panelViewInfo == null)
            {
                return;
            }
            Rectangle bounds = panelViewInfo.Bounds;
            int       minX   = bounds.X;
            RibbonPageGroupViewInfoCollection groups = panelViewInfo.Groups;

            if (groups == null)
            {
                return;
            }
            if (groups.Count > 0)
            {
                minX = groups[groups.Count - 1].Bounds.Right;
            }
            if (bounds.Height < Image.Height)
            {
                return;
            }
            int offset = (bounds.Height - Image.Height) / 2;
            int width  = Image.Width + 15;

            bounds.X = bounds.Width - width;
            if (bounds.X < minX)
            {
                return;
            }
            bounds.Width  = width;
            bounds.Y     += offset;
            bounds.Height = Image.Height;
            graphics.DrawImage(Image, bounds.Location);
        }
 public MyRibbonPanelViewInfo(RibbonViewInfo viewInfo)
     : base(viewInfo)
 {
 }
 public RibbonPageHeaderViewInfoEx(RibbonViewInfo info) : base(info)
 {
 }
 public RibbonCaptionViewInfoEx(RibbonViewInfo info) : base(info)
 {
 }
Exemplo n.º 7
0
 public MyRibbonPageHeaderViewInfo(RibbonViewInfo viewInfo) : base(viewInfo)
 {
 }
Exemplo n.º 8
0
        /// <summary>
        /// Set the default look and feel
        /// </summary>
        /// <param name="lookAndFeelName"></param>

        public static void SetLookAndFeel(
            string lookAndFeelName)
        {
            if (Instance == null)
            {
                Instance = new PreferencesDialog();
            }

            Color mainMenuFontColor = LookAndFeelMx.SetLookAndFeel(lookAndFeelName, Instance.DefaultLookAndFeel.LookAndFeel);

            int mainMenuLeft = 45;

            SessionManager sm = SessionManager.Instance;

            if (sm != null && sm.RibbonCtl != null)
            {
                RibbonControl  ribbon = sm.RibbonCtl;
                RibbonViewInfo vi     = ribbon.ViewInfo;

                ribbon.Minimized = true; // be sure minimized
                if (MobiusIcon == null)
                {
                    MobiusIcon = ribbon.ApplicationIcon;
                }
                if (QuickSearchImageIndex < 0)
                {
                    QuickSearchImageIndex = sm.QuickSearchControl.ImageIndex;
                }

                if (Lex.Contains(lookAndFeelName, "Office 2010"))
                // || Lex.Contains(lookAndFeelName, "Windows 7"))
                { // use new style ribbon
                    ribbon.RibbonStyle               = RibbonControlStyle.Office2010;
                    ribbon.ShowPageHeadersMode       = ShowPageHeadersMode.Hide;
                    ribbon.ApplicationIcon           = null; // don't show Mobius icon on application button
                    ribbon.ApplicationButtonText     = "";
                    sm.QuickSearchControl.ImageIndex = -1;
                }

                else // Office 2007 ribbon
                {
                    ribbon.RibbonStyle               = RibbonControlStyle.Office2007;
                    ribbon.ApplicationIcon           = MobiusIcon;
                    sm.QuickSearchControl.ImageIndex = QuickSearchImageIndex;
                }

                // Obsolete
                //if (sm != null && sm.MainMenuControl != null && sm.ShellForm != null)
                //{
                //	MainMenuControl menu = sm.MainMenuControl;

                //	if (ribbon.RibbonStyle == RibbonControlStyle.Office2010)
                //		mainMenuLeft += 14;

                //	menu.Left = mainMenuLeft;

                //	SetMainMenuTopPosition();

                //	menu.SetFontColor(mainMenuFontColor);
                //}
            }

            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
            Application.DoEvents(); // repaint

            return;

            /// Get skin element color
            //DevExpress.Skins.Skin currentSkin = DevExpress.Skins.CommonSkins.GetSkin(PreferencesDialog.Instance.DefaultLookAndFeel.LookAndFeel);
            //string elementName = DevExpress.Skins.CommonSkins.SkinTextBorder;
            //DevExpress.Skins.SkinElement element = currentSkin[elementName];
            //QueryDescDivider.BackColor = element.Border.All;
        }
 public CustomRibbonPageHeaderViewInfo(RibbonViewInfo viewInfo) : base(viewInfo)
 {
 }
Exemplo n.º 10
0
 public CustomRibbonCaptionViewInfo(RibbonViewInfo viewInfo) : base(viewInfo)
 {
 }
Exemplo n.º 11
0
 public MyRibbonPageGroupViewInfo(RibbonViewInfo viewInfo, RibbonPageGroup group) :
     base(viewInfo, group)
 {
 }
 public MyRibbonCaptionViewInfo(RibbonViewInfo viewInfo) : base(viewInfo)
 {
 }
 public MyRibbonApplicationButtonInfo(RibbonViewInfo viewInfo) : base(viewInfo)
 {
 }