public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
      {
         if (Owner == null) return;

         Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, Bounds, this));

         if (ImageVisible)
            Owner.Renderer.OnRenderRibbonItemImage(new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, _imageBounds));

         using (StringFormat f = StringFormatFactory.NearCenterNoWrap(StringTrimming.None))
         {
            f.Alignment = StringAlignment.Near;
            f.LineAlignment = StringAlignment.Center;
            f.Trimming = StringTrimming.None;
            f.FormatFlags |= StringFormatFlags.NoWrap;

            Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, Bounds, this, TextBoxTextBounds, TextBoxText, f));

            if (LabelVisible)
            {
               f.Alignment = (StringAlignment)TextAlignment;
               Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, Bounds, this, LabelBounds, Text, f));
            }
         }
      }
      /// <summary>
      /// Raises the paint event and draws the
      /// </summary>
      /// <param name="sender"></param>
      /// <param name="e"></param>
      public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
      {
         if (Owner != null)
         {
            StringFormat f = new StringFormat();
            f.Alignment = StringAlignment.Center;
            f.LineAlignment = StringAlignment.Center;
            f.Trimming = StringTrimming.None;
            f.FormatFlags |= StringFormatFlags.NoWrap;
            if (Site != null && Site.DesignMode)
            {
               Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, Bounds, this, Bounds, Site.Name, f));
            }
            else
            {
               Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, Bounds, this, Bounds, this.Text, f));
               if (ctl != null)
               {
                  if (ctl.Parent == null)
                     Owner.Controls.Add(ctl);

                  //time to show our control
                  ctl.Location = new System.Drawing.Point(Bounds.Left + 1, Bounds.Top + 1);
                  ctl.Visible = true;
                  ctl.BringToFront();
               }
            }
         }
      }
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            base.OnPaint(sender, e);

            Color c = this.Color.Equals(Color.Transparent) ? Color.White : Color;

            int h = e.Mode == RibbonElementSizeMode.Large ? ImageColorHeight : SmallImageColorHeight;

            Rectangle colorFill = Rectangle.FromLTRB(
                    ImageBounds.Left,
                    ImageBounds.Bottom - h,
                    ImageBounds.Right,
                    ImageBounds.Bottom
                    );
            SmoothingMode sm = e.Graphics.SmoothingMode;
            e.Graphics.SmoothingMode = SmoothingMode.None;
            using (SolidBrush b = new SolidBrush(c))
            {

                e.Graphics.FillRectangle(b, colorFill);
            }

            if (this.Color.Equals(Color.Transparent))
            {
                e.Graphics.DrawRectangle(Pens.DimGray, colorFill);
            }

            e.Graphics.SmoothingMode = sm;
        }
 /// <summary>
 /// Raises the paint event and draws the
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
 {
    if (Owner != null)
    {
       base.Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(base.Owner, e.Graphics, base.Bounds, this));
       StringFormat f = StringFormatFactory.CenterNoWrap(StringTrimming.None);
       f.Alignment = (StringAlignment)TextAlignment;
       Rectangle clipBounds = Rectangle.FromLTRB(Bounds.Left + 3, Bounds.Top + Owner.ItemMargin.Top, Bounds.Right - 3, Bounds.Bottom - Owner.ItemMargin.Bottom);
       base.Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, Bounds, this, clipBounds, this.Text, f));
    }
 }
Esempio n. 5
0
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(
                Owner, e.Graphics, e.Clip, this));

            if (!string.IsNullOrEmpty(Text))
            {
                Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(
                        Owner, e.Graphics, e.Clip, this,
                        Rectangle.FromLTRB(
                            Bounds.Left + Owner.ItemMargin.Left,
                            Bounds.Top + Owner.ItemMargin.Top,
                            Bounds.Right - Owner.ItemMargin.Right,
                            Bounds.Bottom - Owner.ItemMargin.Bottom), Text, FontStyle.Bold));
            }
        }
Esempio n. 6
0
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if ((Owner == null || !DrawBackground) && !(this.Site != null && this.Site.DesignMode))
            return;

             Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(
             Owner, e.Graphics, e.Clip, this));

             if (!string.IsNullOrEmpty(Text))
             {
            Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(
                    Owner, e.Graphics, e.Clip, this,
                    Rectangle.FromLTRB(
                        Bounds.Left + Owner.ItemMargin.Left,
                        Bounds.Top + Owner.ItemMargin.Top,
                        Bounds.Right - Owner.ItemMargin.Right,
                        Bounds.Bottom - Owner.ItemMargin.Bottom), Text, FontStyle.Bold));
             }
        }
Esempio n. 7
0
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (DrawBackground)
            {
                Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
            }

            foreach (RibbonItem item in Items)
            {
                item.OnPaint(this, new RibbonElementPaintEventArgs(item.Bounds, e.Graphics, RibbonElementSizeMode.Compact));
            }

            if (DrawBackground)
            {
                Owner.Renderer.OnRenderRibbonItemBorder(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
            }
        }
 public abstract void OnPaint(object sender, RibbonElementPaintEventArgs e);
Esempio n. 9
0
        /// <summary>
        /// Raises the paint event and draws the
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (!avoidPaintBg)
            {
                Owner.Renderer.OnRenderRibbonPanelBackground(new RibbonPanelRenderEventArgs(Owner, e.Graphics, e.Clip, this, Owner));

                Owner.Renderer.OnRenderRibbonPanelText(new RibbonPanelRenderEventArgs(Owner, e.Graphics, e.Clip, this, Owner));
            }

            if (e.Mode != RibbonElementSizeMode.Overflow ||
                (e.Control != null && e.Control == PopUp))
            {

                foreach (RibbonItem item in Items)
                {
                    item.OnPaint(this, new RibbonElementPaintEventArgs(item.Bounds, e.Graphics, item.SizeMode));
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (Owner == null)
            {
                return;
            }
            RibbonElementSizeMode theSize = GetNearestSize(e.Mode);

            Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));

            Rectangle img = Rectangle.Empty;

            if (theSize == RibbonElementSizeMode.Large)
            {
                if (Image != null)
                {
                    img = new Rectangle(
                        Bounds.Left + ((Bounds.Width - Image.Width) / 2),
                        Bounds.Top + Owner.ItemMargin.Top,
                        Image.Width,
                        Image.Height);

                    Owner.Renderer.OnRenderRibbonItemImage(
                        new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, img));
                }
            }
            else
            {
                if (SmallImage != null)
                {
                    img = new Rectangle(
                        Bounds.Left + Owner.ItemMargin.Left,
                        Bounds.Top + ((Bounds.Height - SmallImage.Height) / 2),
                        SmallImage.Width,
                        SmallImage.Height);

                    Owner.Renderer.OnRenderRibbonItemImage(
                        new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, img));
                }
            }

            Rectangle t    = Rectangle.Empty;
            int       imgw = SmallImage == null ? 16 : SmallImage.Width;
            int       imgh = Image == null ? 32 : Image.Height;

            if (theSize == RibbonElementSizeMode.Large)
            {
                t = Rectangle.FromLTRB(
                    Bounds.Left + Owner.ItemMargin.Left,
                    Bounds.Top + Owner.ItemMargin.Top + imgh + Owner.ItemMargin.Vertical,
                    Bounds.Right - Owner.ItemMargin.Right,
                    Bounds.Bottom - Owner.ItemMargin.Bottom);

                if (SizeMode != RibbonElementSizeMode.Compact)
                {
                    Owner.Renderer.OnRenderRibbonItemText(
                        new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, t));
                }
            }
            else
            {
                int ddw = Style != RibbonButtonStyle.Normal ? _dropDownMargin.Horizontal : 0;
                t = Rectangle.FromLTRB(
                    Bounds.Left + imgw + Owner.ItemMargin.Horizontal + Owner.ItemMargin.Left,
                    Bounds.Top + Owner.ItemMargin.Top,
                    Bounds.Right - ddw,
                    Bounds.Bottom - Owner.ItemMargin.Bottom);

                if (SizeMode != RibbonElementSizeMode.Compact)
                {
                    Owner.Renderer.OnRenderRibbonItemText(
                        new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, t));
                }
            }
        }
        /// <summary>
        /// Raises the paint event and draws the
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public virtual void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (Paint != null)
             {
            Paint(this, new PaintEventArgs(e.Graphics, e.Clip));
             }

             if (PopupShowed && e.Control == Owner)
             {
            //Draw a fake collapsed and pressed panel

            #region Create fake panel
            RibbonPanel fakePanel = new RibbonPanel(this.Text);
            fakePanel.Image = this.Image;
            fakePanel.SetSizeMode(RibbonElementSizeMode.Overflow);
            fakePanel.SetBounds(overflowBoundsBuffer);
            fakePanel.SetPressed(true);
            fakePanel.SetOwner(Owner);
            #endregion

            Owner.Renderer.OnRenderRibbonPanelBackground(new RibbonPanelRenderEventArgs(Owner, e.Graphics, e.Clip, fakePanel, e.Control));
            Owner.Renderer.OnRenderRibbonPanelText(new RibbonPanelRenderEventArgs(Owner, e.Graphics, e.Clip, fakePanel, e.Control));
             }
             else
             {
            //Draw normal
            Owner.Renderer.OnRenderRibbonPanelBackground(new RibbonPanelRenderEventArgs(Owner, e.Graphics, e.Clip, this, e.Control));
            Owner.Renderer.OnRenderRibbonPanelText(new RibbonPanelRenderEventArgs(Owner, e.Graphics, e.Clip, this, e.Control));
             }

             if (e.Mode != RibbonElementSizeMode.Overflow ||
             (e.Control != null && e.Control == PopUp))
             {
            foreach (RibbonItem item in Items)
            {
                    if (item.Visible || Owner.IsDesignMode())
                  item.OnPaint(this, new RibbonElementPaintEventArgs(item.Bounds, e.Graphics, item.SizeMode));
            }
             }
        }
Esempio n. 12
0
 public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
 {
     Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
 }
      public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
      {
         if (Owner != null)
         {
            Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, Bounds, this));

            if (Style == CheckBoxStyle.CheckBox)
            {
               CheckBoxState CheckState = Checked == true ? CheckBoxState.CheckedNormal : CheckBoxState.UncheckedNormal;
               if (Selected)
                  CheckState += 1;

               CheckBoxRenderer.DrawCheckBox(e.Graphics, new Point(_checkboxBounds.Left, _checkboxBounds.Top), CheckState);
            }
            else
            {
               RadioButtonState RadioState = Checked == true ? RadioButtonState.CheckedNormal : RadioButtonState.UncheckedNormal;
               if (Selected)
                  RadioState += 1;
               RadioButtonRenderer.DrawRadioButton(e.Graphics, new Point(_checkboxBounds.Left, _checkboxBounds.Top), RadioState);
            }

            if (LabelVisible)
            {
               StringFormat f = new StringFormat();
               if (_CheckBoxOrientation == CheckBoxOrientationEnum.Left)
                  f.Alignment = StringAlignment.Near;
               else
                  f.Alignment = StringAlignment.Far;

               f.LineAlignment = StringAlignment.Far; //Top
               f.Trimming = StringTrimming.None;
               f.FormatFlags |= StringFormatFlags.NoWrap;
               Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, _labelBounds, this, LabelBounds, Text, f));
            }
         }
      }
        public void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (Owner == null) return;

            if (ContextualTabsCount > 0 || Owner.IsDesignMode())
            {
                Owner.Renderer.OnRenderRibbonContext(new RibbonContextRenderEventArgs(Owner, e.Graphics, e.Clip, this));
                Owner.Renderer.OnRenderRibbonContextText(new RibbonContextRenderEventArgs(Owner, e.Graphics, e.Clip, this));
            }
        }
Esempio n. 15
0
 /// <summary>
 /// Renders the background of the buton
 /// </summary>
 /// <param name="e"></param>
 private void OnPaintBackground(RibbonElementPaintEventArgs e)
 {
     Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
 }
Esempio n. 16
0
 public abstract void OnPaint(object sender, RibbonElementPaintEventArgs e);
Esempio n. 17
0
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, Bounds, this));
            if(ImageVisible)
                Owner.Renderer.OnRenderRibbonItemImage(new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, _imageBounds));

            Owner.Renderer.OnRenderRibbonItemText(new RibbonItemBoundsEventArgs(Owner, e.Graphics, Bounds, this, _labelBounds));
        }
		public void OnPaint(object sender, RibbonElementPaintEventArgs e)
		{
			if (Owner == null) return;

            Owner.Renderer.OnRenderRibbonTab(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));
            Owner.Renderer.OnRenderRibbonTabText(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));

			if (Active && (!Owner.Minimized || (Owner.Minimized && Owner.Expanded)))
			{
                int displayIndex = 0;
                foreach (RibbonPanel panel in Panels)
				{
					if (panel.Visible)
                    {
                        panel.Index = displayIndex;
                        panel.IsFirstPanel = (displayIndex == 0);                       

						panel.OnPaint(this, new RibbonElementPaintEventArgs(e.Clip, e.Graphics, panel.SizeMode, e.Control));

                        displayIndex++;
			        }	
                }

                foreach (RibbonPanel panel in Panels)
                {
                    if (panel.Visible)
                    {
                        panel.IsLastPanel = (panel.Index == displayIndex - 1);
                        break;
                    }
                }
            }

			Owner.Renderer.OnRenderTabScrollButtons(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));
		}
Esempio n. 19
0
 public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
 {
     Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
 }
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            Owner.Renderer.OnRenderRibbonQuickAccessToolbarBackground(new RibbonRenderEventArgs(Owner, e.Graphics, e.Clip));

            foreach (RibbonItem item in Items)
            {
                item.OnPaint(this, new RibbonElementPaintEventArgs(item.Bounds, e.Graphics, RibbonElementSizeMode.Compact));
            }

        }
Esempio n. 21
0
        protected override void OnPaintText(RibbonElementPaintEventArgs e)
        {
            if (e.Mode == RibbonElementSizeMode.DropDown)
            {
                StringFormat sf = new StringFormat();
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment = StringAlignment.Near;

                Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(
                    Owner, e.Graphics, e.Clip, this, TextBounds, Text, Color.Empty, FontStyle.Bold, sf));

                sf.Alignment = StringAlignment.Near;

                Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(
                    Owner, e.Graphics, e.Clip, this, DescriptionBounds, Description, sf));
            }
            else
            {
                base.OnPaintText(e);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (Owner == null) return;

            OnPaintBackground(e);

            OnPaintImage(e);

            OnPaintText(e);
        }
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (Visible && Owner.CaptionBarVisible)
            {
                if (Owner.OrbStyle == RibbonOrbStyle.Office_2007)
                    Owner.Renderer.OnRenderRibbonQuickAccessToolbarBackground(new RibbonRenderEventArgs(Owner, e.Graphics, e.Clip));

                foreach (RibbonItem item in Items)
                {
                    item.OnPaint(this, new RibbonElementPaintEventArgs(item.Bounds, e.Graphics, RibbonElementSizeMode.Compact));
                }
            }
        }
Esempio n. 24
0
 /// <summary>
 /// Renders the background of the buton
 /// </summary>
 /// <param name="e"></param>
 private void OnPaintBackground(RibbonElementPaintEventArgs e)
 {
     Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
 }
Esempio n. 25
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (Owner == null) return;
            RibbonElementSizeMode theSize = GetNearestSize(e.Mode);

            Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));

            Rectangle img = Rectangle.Empty;

            if (theSize == RibbonElementSizeMode.Large)
            {
                if (Image != null)
                {
                    img = new Rectangle(
                    Bounds.Left + ((Bounds.Width - Image.Width) / 2),
                    Bounds.Top + Owner.ItemMargin.Top,
                    Image.Width,
                    Image.Height);

                    Owner.Renderer.OnRenderRibbonItemImage(
                        new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, img));
                }
            }
            else
            {

                if (SmallImage != null)
                {
                    img = new Rectangle(
                    Bounds.Left + Owner.ItemMargin.Left,
                    Bounds.Top + ((Bounds.Height - SmallImage.Height) / 2),
                    SmallImage.Width,
                    SmallImage.Height);

                    Owner.Renderer.OnRenderRibbonItemImage(
                        new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, img));
                }
            }

            Rectangle t = Rectangle.Empty;
            int imgw = SmallImage == null ? 16 : SmallImage.Width;
            int imgh = Image == null ? 32 : Image.Height;

            if (theSize == RibbonElementSizeMode.Large)
            {
                t = Rectangle.FromLTRB(
                    Bounds.Left + Owner.ItemMargin.Left,
                    Bounds.Top + Owner.ItemMargin.Top + imgh + Owner.ItemMargin.Vertical,
                    Bounds.Right - Owner.ItemMargin.Right,
                    Bounds.Bottom - Owner.ItemMargin.Bottom);

                if(SizeMode != RibbonElementSizeMode.Compact)
                Owner.Renderer.OnRenderRibbonItemText(
                    new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, t));
            }
            else
            {
                int ddw = Style != RibbonButtonStyle.Normal ? _dropDownMargin.Horizontal : 0;
                t = Rectangle.FromLTRB(
                    Bounds.Left + imgw + Owner.ItemMargin.Horizontal + Owner.ItemMargin.Left,
                    Bounds.Top + Owner.ItemMargin.Top,
                    Bounds.Right - ddw,
                    Bounds.Bottom - Owner.ItemMargin.Bottom);

                if (SizeMode != RibbonElementSizeMode.Compact)
                Owner.Renderer.OnRenderRibbonItemText(
                    new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, t));
            }
        }
Esempio n. 26
0
		public void OnPaint(object sender, RibbonElementPaintEventArgs e)
		{
			if (Owner == null) return;

			Owner.Renderer.OnRenderRibbonTab(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));
			Owner.Renderer.OnRenderRibbonTabText(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));

			if (Active && (!Owner.Minimized || (Owner.Minimized && Owner.Expanded)))
			{
				foreach (RibbonPanel panel in Panels)
				{
					if (panel.Visible)
						panel.OnPaint(this, new RibbonElementPaintEventArgs(e.Clip, e.Graphics, panel.SizeMode, e.Control));
				}
			}

			Owner.Renderer.OnRenderTabScrollButtons(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));
		}
Esempio n. 27
0
        /// <summary>
        /// Renders text of the button
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnPaintText(RibbonElementPaintEventArgs e)
        {
            if (SizeMode != RibbonElementSizeMode.Compact)
            {
                StringFormat sf = new StringFormat();
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment = StringAlignment.Near;

                if (SizeMode == RibbonElementSizeMode.Large)
                {
                    sf.Alignment = StringAlignment.Center;

                    if (!string.IsNullOrEmpty(Text) && !Text.Contains(" "))
                    {
                        sf.LineAlignment = StringAlignment.Near;
                    }
                }

                Owner.Renderer.OnRenderRibbonItemText(
                    new RibbonTextEventArgs(Owner, e.Graphics, e.Clip, this, TextBounds, Text, sf));
            }
        }
 /// <summary>
 /// Raises the paint event and draws the control
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
 {
    if (Owner != null)
    {
       StringFormat f = StringFormatFactory.CenterNoWrap(StringTrimming.None);
       if (Site != null && Site.DesignMode)
       {
          Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, Bounds, this, Bounds, Site.Name, f));
       }
       else
       {
          Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(Owner, e.Graphics, Bounds, this, Bounds, this.Text, f));
          if (ctl != null)
          {
              if (ctl.Parent != Canvas)
                  Canvas.Controls.Add(ctl);
              
             //time to show our control
              ctl.Location = new System.Drawing.Point(Bounds.Left, (this.SizeMode == RibbonElementSizeMode.DropDown) ? Bounds.Top:  Bounds.Top);
             ctl.Visible = true;
             ctl.BringToFront();
          }
       }
    }
 }
Esempio n. 29
0
 /// <summary>
 /// Renders the image of the button
 /// </summary>
 /// <param name="e"></param>
 private void OnPaintImage(RibbonElementPaintEventArgs e)
 {
     RibbonElementSizeMode theSize = GetNearestSize(e.Mode);
     if ((theSize == RibbonElementSizeMode.Large && Image != null) || SmallImage != null)
     {
         Owner.Renderer.OnRenderRibbonItemImage(
             new RibbonItemBoundsEventArgs(Owner, e.Graphics, e.Clip, this, OnGetImageBounds(theSize, Bounds)));
     }
 }
Esempio n. 30
0
        public void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (Owner == null) return;

            Owner.Renderer.OnRenderRibbonTab(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));
            Owner.Renderer.OnRenderRibbonTabText(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));

            if(Active)
                foreach (RibbonPanel panel in Panels)
                {
                    panel.OnPaint(this, new RibbonElementPaintEventArgs(e.Clip, e.Graphics, panel.SizeMode));
                }

            Owner.Renderer.OnRenderTabScrollButtons(new RibbonTabRenderEventArgs(Owner, e.Graphics, e.Clip, this));
        }
      public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
      {
         Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));

         if (e.Mode != RibbonElementSizeMode.Compact)
         {
            Region lastClip = e.Graphics.Clip;
            Region newClip = new Region(lastClip.GetBounds(e.Graphics));
            newClip.Intersect(ContentBounds);
            e.Graphics.SetClip(newClip.GetBounds(e.Graphics));

            foreach (RibbonButton button in Buttons)
            {
               if (!button.Bounds.IsEmpty)
                  button.OnPaint(this, new RibbonElementPaintEventArgs(button.Bounds, e.Graphics, ButtonsSizeMode));
            }
            e.Graphics.SetClip(lastClip.GetBounds(e.Graphics));
         }
      }
        /// <summary>
        /// Renders text of the button
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnPaintText(RibbonElementPaintEventArgs e)
        {
            if (SizeMode != RibbonElementSizeMode.Compact)
            {
                StringFormat sf = StringFormatFactory.NearCenter();

                if (this.Owner.AltPressed || this.Owner.OrbDropDown.MenuItems.Contains(this))
                {
                    
                    sf.HotkeyPrefix = Drawing.Text.HotkeyPrefix.Show;

                }
                else
                {

                    sf.HotkeyPrefix = Drawing.Text.HotkeyPrefix.Hide;
                }

                if (SizeMode == RibbonElementSizeMode.Large)
                {
                    sf.Alignment = StringAlignment.Center;
                    sf.LineAlignment = StringAlignment.Near;
                }

                if (Style == RibbonButtonStyle.DropDownListItem)
                {
                    sf.LineAlignment = StringAlignment.Near;
                    Owner.Renderer.OnRenderRibbonItemText(
                        new RibbonTextEventArgs(Owner, e.Graphics, e.Clip, this, Bounds, Text, sf));
                }
                else
                {
                    var newText = Text;

                    if (!String.IsNullOrEmpty(this.AltKey) && this.Text.Contains(AltKey))
                    {

                        var regex = new Regex(Regex.Escape(this.AltKey), RegexOptions.IgnoreCase);

                        newText = regex.Replace(this.Text.Replace("&", ""), "&" + this.AltKey, 1).Replace("&&", "&");
                    }

                    Owner.Renderer.OnRenderRibbonItemText(
                        new RibbonTextEventArgs(Owner, e.Graphics, e.Clip, this, TextBounds, newText, sf));
                }
            }
        }