Esempio n. 1
0
        private static Office2007CheckBoxStateColorTable GetCheckBoxStateColorTable(NodeCellRendererEventArgs e)
        {
            Cell cell = e.Cell;

            if (ColorTable != null && BarFunctions.IsOffice2007Style(e.ColorScheme.Style))
            {
                Office2007CheckBoxColorTable ct = ColorTable;
                if (!cell.GetEnabled())
                    return ct.Disabled;
                //else if (cell.IsMouseDown)
                //    return ct.Pressed;
                //else if (cell.IsMouseOver)
                //    return ct.MouseOver;
                return ct.Default;
            }
            else
            {
                ColorScheme cs = e.ColorScheme;
                // Create color table based on the ColorScheme object...
                Office2007CheckBoxStateColorTable ct = new Office2007CheckBoxStateColorTable();
                if (!cell.GetEnabled())
                {
                    ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
                    ct.CheckBorder = cs.ItemDisabledText;
                    ct.CheckInnerBorder = cs.ItemDisabledText;
                    ct.CheckInnerBackground = new LinearGradientColorTable();
                    ct.CheckSign = new LinearGradientColorTable(cs.ItemDisabledText, Color.Empty);
                    ct.Text = cs.ItemDisabledText;
                }
                //else if (cell.IsMouseDown)
                //{
                //    ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
                //    ct.CheckBorder = cs.ItemPressedBorder;
                //    ct.CheckInnerBorder = cs.ItemPressedBorder;
                //    ct.CheckInnerBackground = new LinearGradientColorTable(cs.ItemPressedBackground, cs.ItemPressedBackground2);
                //    ct.CheckSign = new LinearGradientColorTable(cs.ItemPressedText, Color.Empty);
                //    ct.Text = cs.ItemPressedText;
                //}
                //else if (cell.IsMouseOver)
                //{
                //    ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
                //    ct.CheckBorder = cs.ItemHotBorder;
                //    ct.CheckInnerBorder = cs.ItemHotBorder;
                //    ct.CheckInnerBackground = new LinearGradientColorTable(cs.ItemHotBackground, cs.ItemHotBackground2);
                //    ct.CheckSign = new LinearGradientColorTable(cs.ItemHotText, Color.Empty);
                //    ct.Text = cs.ItemHotText;
                //}
                else
                {
                    ct.CheckBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
                    ct.CheckBorder = cs.PanelBorder;
                    ct.CheckInnerBorder = ColorBlendFactory.SoftLight(cs.PanelBorder, Color.White);
                    ct.CheckInnerBackground = new LinearGradientColorTable(cs.MenuBackground, Color.Empty);
                    ct.CheckSign = new LinearGradientColorTable(cs.ItemText, Color.Empty);
                    ct.Text = cs.ItemText;
                }
                return ct;
            }
        }
Esempio n. 2
0
		public static void PaintCell(NodeCellRendererEventArgs ci)
		{
			if(ci.Cell.CheckBoxVisible)
				CellDisplay.PaintCellCheckBox(ci);
			if(!ci.Cell.Images.LargestImageSize.IsEmpty)
				CellDisplay.PaintCellImage(ci);
			CellDisplay.PaintText(ci);
		}
Esempio n. 3
0
		public static void PaintCellCheckBox(NodeCellRendererEventArgs ci)
		{
			if(!ci.Cell.CheckBoxVisible)
				return;
            Cell cell = ci.Cell;
            Rectangle r = cell.CheckBoxBoundsRelative;
			r.Offset(ci.CellOffset);

            if (ci.CheckBoxImageChecked != null)
            {
                Image img = ci.CheckBoxImageChecked;
                if (cell.CheckState == System.Windows.Forms.CheckState.Unchecked)
                    img = ci.CheckBoxImageUnChecked;
                else if (cell.CheckState == System.Windows.Forms.CheckState.Indeterminate)
                    img = ci.CheckBoxImageIndeterminate;
                if (img != null)
                    ci.Graphics.DrawImage(img, r);
            }
            else if (_CheckBoxPainter != null)
            {
                Office2007CheckBoxStateColorTable ct = GetCheckBoxStateColorTable(ci);
                if (cell.CheckBoxStyle == eCheckBoxStyle.CheckBox)
                {
                    _CheckBoxPainter.PaintCheckBox(ci.Graphics, r, ct, cell.CheckState);
                }
                else
                {
                    _CheckBoxPainter.PaintRadioButton(ci.Graphics, r, ct, cell.Checked);
                }
            }
            else
            {
                System.Windows.Forms.ButtonState state = System.Windows.Forms.ButtonState.Normal;
                if (ci.Cell.Checked)
                    state = System.Windows.Forms.ButtonState.Checked;
                System.Windows.Forms.ControlPaint.DrawCheckBox(ci.Graphics, r, state);
            }
		}
Esempio n. 4
0
		/// <summary>
		/// Raises RenderCellImage event.
		/// </summary>
		/// <param name="e">Event arguments</param>
		protected virtual void OnRenderCellText(NodeCellRendererEventArgs e)
		{
			if(RenderCellText!=null)
				RenderCellText(this, e);
		}
Esempio n. 5
0
		/// <summary>
		/// Draws cell text. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
		/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellText method so events can occur.
		/// </summary>
		/// <param name="e">Information provided for rendering.</param>
		public virtual void DrawCellText(NodeCellRendererEventArgs e)
		{
			OnRenderCellText(e);
		}
Esempio n. 6
0
		/// <summary>
		/// Raises RenderCellImage event.
		/// </summary>
		/// <param name="e">Event arguments</param>
		protected virtual void OnRenderCellImage(NodeCellRendererEventArgs e)
		{
			if(RenderCellImage!=null)
				RenderCellImage(this, e);
		}
Esempio n. 7
0
		/// <summary>
		/// Draws cell image. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
		/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellImage method so events can occur.
		/// </summary>
		/// <param name="e">Information provided for rendering.</param>
		public virtual void DrawCellImage(NodeCellRendererEventArgs e)
		{
			OnRenderCellImage(e);
		}
Esempio n. 8
0
		/// <summary>
		/// Raises RenderCellCheckBox event.
		/// </summary>
		/// <param name="e">Event arguments</param>
		protected virtual void OnRenderCellCheckBox(NodeCellRendererEventArgs e)
		{
			if(RenderCellCheckBox!=null)
				RenderCellCheckBox(this, e);
		}
Esempio n. 9
0
		/// <summary>
		/// Draws cell check box.  If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
		/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellCheckBox method so events can occur.
		/// </summary>
		/// <param name="e">Information provided for rendering.</param>
		public virtual void DrawCellCheckBox(NodeCellRendererEventArgs e)
		{
			OnRenderCellCheckBox(e);
		}
Esempio n. 10
0
		/// <summary>
		/// Raises RenderCellBackground event.
		/// </summary>
		/// <param name="e">Event arguments</param>
		protected virtual void OnRenderCellBackground(NodeCellRendererEventArgs e)
		{
			if(RenderCellBackground!=null)
				RenderCellBackground(this, e);
		}
Esempio n. 11
0
        ///// <summary>
        ///// Draws node command part. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
        ///// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeCommandPart method so events can occur.
        ///// </summary>
        ///// <param name="e">Information provided for rendering.</param>
        //public virtual void DrawNodeCommandPart(NodeCommandPartRendererEventArgs e)
        //{
        //    OnRenderNodeCommandPart(e);
        //}
		
        ///// <summary>
        ///// Raises RenderNodeCommandPart event.
        ///// </summary>
        ///// <param name="e">Event arguments.</param>
        //protected virtual void OnRenderNodeCommandPart(NodeCommandPartRendererEventArgs e)
        //{
        //    if(RenderNodeCommandPart!=null)
        //        RenderNodeCommandPart(this,e);
        //}
		
		/// <summary>
		/// Draws cell background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
		/// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellBackground method so events can occur.
		/// </summary>
		/// <param name="e">Information provided for rendering.</param>
		public virtual void DrawCellBackground(NodeCellRendererEventArgs e)
		{
			OnRenderCellBackground(e);
		}
Esempio n. 12
0
        public static void PaintText(NodeCellRendererEventArgs ci)
        {
            Cell cell = ci.Cell;
            if (cell.HostedControl == null && cell.HostedItem == null && (cell.DisplayText == "" || ci.Style.TextColor.IsEmpty) || cell.TextContentBounds.IsEmpty)
                return;

            Rectangle bounds = ci.Cell.TextContentBounds;
            bounds.Offset(ci.CellOffset);

            Graphics g = ci.Graphics;
            if (cell.HostedControl != null)
            {
                if (!cell.HostedControl.Visible)
                    cell.HostedControl.Visible = true;
                return;
            }
            else if (cell.HostedItem != null)
            {
                BaseItem item = cell.HostedItem;
                if (item.ItemAlignment == eItemAlignment.Near)
                    item.LeftInternal = bounds.X;
                else if (item.ItemAlignment == eItemAlignment.Far)
                    item.LeftInternal = bounds.X + (bounds.Width - item.WidthInternal);
                else if (item.ItemAlignment == eItemAlignment.Center)
                    item.LeftInternal = bounds.X + (bounds.Width - item.WidthInternal) / 2;
                if (item.DisplayRectangle.Height < bounds.Height)
                    item.TopInternal = bounds.Y + (bounds.Height - item.DisplayRectangle.Height) / 2;
                else
                    item.TopInternal = bounds.Y;
                item.Displayed = true;
                Region oldClip = g.Clip;
                Rectangle cb = bounds;
                cb.Inflate(2, 1);
                g.SetClip(cb, CombineMode.Intersect);
                item.Paint(ci.ItemPaintArgs);
                if (oldClip != null)
                {
                    g.Clip = oldClip;
                    oldClip.Dispose();
                }
                return;
            }

            Font font = ci.Style.Font;
            if (bounds.Width > 1 && bounds.Height > 1)
            {
                //eTextFormat textFormat = ci.Style.TextFormat;
                //textFormat = textFormat & ~(textFormat & eTextFormat.HidePrefix);
                //textFormat |= eTextFormat.NoPrefix;
                if (cell.TextMarkupBody == null)
                {
                    TextDrawing.DrawString(g, cell.DisplayText, font, ci.Style.TextColor, bounds, ci.Style.TextFormat);
                }
                else
                {
                    DevComponents.DotNetBar.TextMarkup.MarkupDrawContext d = new DevComponents.DotNetBar.TextMarkup.MarkupDrawContext(g, font, ci.Style.TextColor, false);
                    d.HotKeyPrefixVisible = !((ci.Style.TextFormat & eTextFormat.HidePrefix) == eTextFormat.HidePrefix);
                    Rectangle mr = Rectangle.Empty;
                    eStyleTextAlignment lineAlignment = ci.Style.TextLineAlignment;
                    if (lineAlignment == eStyleTextAlignment.Center)
                    {
                        mr = new Rectangle(bounds.X, bounds.Y + (bounds.Height - cell.TextMarkupBody.Bounds.Height) / 2, cell.TextMarkupBody.Bounds.Width, cell.TextMarkupBody.Bounds.Height);
                    }
                    else if (lineAlignment == eStyleTextAlignment.Near)
                    {
                        mr = new Rectangle(bounds.X, bounds.Y, cell.TextMarkupBody.Bounds.Width, cell.TextMarkupBody.Bounds.Height);
                    }
                    else // Far
                    {
                        mr = new Rectangle(bounds.X, bounds.Y + (bounds.Height - cell.TextMarkupBody.Bounds.Height), cell.TextMarkupBody.Bounds.Width, cell.TextMarkupBody.Bounds.Height);
                    }

                    cell.TextMarkupBody.Bounds = mr;
                    cell.TextMarkupBody.Render(d);
                }
            }
        }
Esempio n. 13
0
		public static void PaintCellImage(NodeCellRendererEventArgs ci)
		{
			if(ci.Cell.Images.LargestImageSize.IsEmpty)
				return;
			Rectangle r=ci.Cell.ImageBoundsRelative;
			r.Offset(ci.CellOffset);
			
			Image image = CellDisplay.GetCellImage(ci.Cell);
			
			if(image!=null)
			{
                ci.Graphics.DrawImage(image, r.X + (r.Width - image.Width) / 2,
                                      r.Y + (r.Height - image.Height) / 2, image.Width, image.Height);
			}
		}