private void customBarAndDockingController1_CustomDraw(object sender, CustomDrawLinkArgs e) { e.DefaultDraw(); string itemCaption = e.Info.LinkInfo.Link.Item.Caption; if (itemCaption == "Green item") { using (Pen p = new Pen(Color.ForestGreen) { Width = 3 }) e.Graphics.DrawRectangle(p, e.Info.LinkInfo.CaptionRect); } if (itemCaption == "See Messages ") { int side = 15; Rectangle iconRect = new Rectangle(e.Bounds.Right - side, e.Bounds.Y, side, side); e.Graphics.FillEllipse(Brushes.IndianRed, iconRect); Point p = new Point(iconRect.Location.X + 2, iconRect.Location.Y); e.Graphics.DrawString(spinEdit1.Value.ToString(), e.Info.LinkInfo.AppearanceMenuItemCaption.Normal.Font, Brushes.White, p); } if (itemCaption == "Static text") { using (SolidBrush br = new SolidBrush(Color.FromArgb(100, 50, 200, 50))) e.Graphics.FillRectangle(br, e.Info.LinkInfo.Bounds); } e.Handled = true; }
protected internal virtual void RaiseCustomDraw(CustomDrawLinkArgs e) { if (CustomDraw != null) { CustomDraw(this, e); } }
protected override void DrawLink(GraphicsInfoArgs e, BarControlViewInfo viewInfo, BarLinkViewInfo item) { BarLinkObjectInfoArgs info = new BarLinkObjectInfoArgs(item) { Cache = e.Cache }; CustomDrawLinkArgs args = new CustomDrawLinkArgs(info); CustomBarAndDockingController controller = item.Bar.Manager.Controller as CustomBarAndDockingController; if (controller != null) { args.SetDefaultDraw(() => { base.DrawLink(e, viewInfo, item); }); controller.RaiseCustomDraw(args); } if (!args.Handled) { args.DefaultDraw(); } }