public virtual void DrawCommandButton(NodeCommandPartRendererEventArgs info) { bool mouseOver = (info.Node.MouseOverNodePart == eMouseOverNodePart.Command); CommandColors c=new CommandColors(); if(mouseOver) { c.BackColor = info.MouseOverBackColor; c.BackColor2 = info.MouseOverBackColor2; c.BackColorGradientAngle = info.MouseOverBackColorGradientAngle; c.ForeColor = info.MouseOverForeColor; } else { c.BackColor = info.BackColor; c.BackColor2 = info.BackColor2; c.BackColorGradientAngle = info.BackColorGradientAngle; c.ForeColor = info.ForeColor; } Rectangle fillBounds = info.CommandPartBounds; fillBounds.Width--; fillBounds.Height--; Region oldRegion = info.Graphics.Clip.Clone() as Region; info.Graphics.SetClip(fillBounds,CombineMode.Intersect); if(c.BackColor2.IsEmpty) { if(!c.BackColor.IsEmpty) { using(SolidBrush brush=new SolidBrush(c.BackColor)) info.Graphics.FillRectangle(brush,fillBounds); } } else { using(LinearGradientBrush brush=DisplayHelp.CreateLinearGradientBrush(info.CommandPartBounds, c.BackColor, c.BackColor2, c.BackColorGradientAngle)) info.Graphics.FillRectangle(brush,fillBounds); } if(c.ForeColor.IsEmpty) return; int width=6; int height=3; GraphicsPath path=new GraphicsPath(); Point p=new Point(info.CommandPartBounds.X+(info.CommandPartBounds.Width-width)/2,info.CommandPartBounds.Y+(info.CommandPartBounds.Height-height)/2); path.AddLine(p.X, p.Y, p.X+width,p.Y); path.AddLine(p.X+width,p.Y,p.X+width/2,p.Y+height); path.AddLine(p.X, p.Y,p.X+width/2,p.Y+height); path.CloseAllFigures(); using(SolidBrush brush=new SolidBrush(c.ForeColor)) info.Graphics.FillPath(brush,path); path.Dispose(); info.Graphics.Clip = oldRegion; }
/// <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 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 override void DrawNodeCommandPart(NodeCommandPartRendererEventArgs e) { m_NodeCommandDisplay.DrawCommandButton(e); base.DrawNodeCommandPart(e); }
/// <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); }