private Rectangle GetHeadRect(IOutlookBarBand var_symbol) { int num1 = this.selectorGroups.IndexOf(this.currentGroup); num1 = Math.Max(0, num1); int num2 = this.selectorGroups.IndexOf(var_symbol); if (num2 > num1) { num2 = this.selectorGroups.Count - num2; return(new Rectangle(0, base.Height - (num2 * this.headHeight), base.Width, this.headHeight)); } return(new Rectangle(0, num2 * this.headHeight, base.Width, this.headHeight)); }
//绘制一组 private void DrawHeaders(Graphics g, IOutlookBarBand var_symbol) { if (var_symbol != null) { RectangleF ef1 = (RectangleF)this.GetHeadRect(var_symbol); Color color1 = this.titleColor; Color color2 = ControlPaint.LightLight(color1); Color color3 = ControlPaint.Dark(color1); g.FillRectangle(new SolidBrush(color2), ef1); using (GraphicsPath path1 = new GraphicsPath()) { ef1.Inflate(-1f, -1f); ef1.Width -= 1f; float single1 = 1f; float single2 = 1f; single1 = Math.Min((float)(ef1.Width / 2f), single1); single2 = Math.Min((float)(ef1.Height / 2f), single2); float single3 = (ef1.X + ef1.Width) - single1; path1.AddLine((float)(ef1.X + single1), ef1.Y, single3, ef1.Y); path1.AddArc((float)(single3 - single1), ef1.Y, (float)(single1 * 2f), (float)(single2 * 2f), (float)270f, (float)90f); float single4 = ef1.X + ef1.Width; float single5 = (ef1.Y + ef1.Height) - single2; path1.AddLine(single4, (float)(ef1.Y + single2), single4, single5); path1.AddArc((float)(single4 - (single1 * 2f)), (float)(single5 - single2), (float)(single1 * 2f), (float)(single2 * 2f), (float)0f, (float)90f); path1.AddLine((float)(single4 - single1), (float)(ef1.Y + ef1.Height), (float)(ef1.X + single1), (float)(ef1.Y + ef1.Height)); path1.AddArc(ef1.X, (float)(single5 - single2), (float)(single1 * 2f), (float)(single2 * 2f), (float)90f, (float)90f); path1.AddLine(ef1.X, single5, ef1.X, (float)(ef1.Y + single2)); path1.AddArc(ef1.X, ef1.Y, (float)(single1 * 2f), (float)(single2 * 2f), (float)180f, (float)90f); path1.CloseFigure(); using (Brush brush1 = new LinearGradientBrush(ef1, Color.White, color2, LinearGradientMode.Vertical)) { g.FillPath(brush1, path1); g.DrawPath(new Pen(color3), path1); using (StringFormat format1 = new StringFormat(StringFormat.GenericTypographic)) { format1.FormatFlags = StringFormatFlags.MeasureTrailingSpaces; format1.LineAlignment = StringAlignment.Center; g.DrawString(var_symbol.Id, SystemInformation.MenuFont, Brushes.Black, new RectangleF(ef1.X + 4f, ef1.Y + 2f, ef1.Width - 8f, ef1.Height - 4f), format1); } } } } }
// Methods public OutlookBar() { this.components = null; this.selectorGroups = new ArrayList(); this.headHeight = 22; this.panelSize = new Size(48, 48); this.outlookSize = new Size(50, 50); this.shapePanel = null; this.currentGroup = null; this.itemHeight = 40; this.selectChanged = false; this.selectedIndex = -1; this.contentColor = ControlPaint.LightLight(Color.SkyBlue); this.selectedObject = null; this.dragBegin = false; this.ibDrag = false; this.toolTip = new ToolTip(); this.showToolTip = false; this.titleColor = SystemColors.ControlLight; this.InitializeComponent(); this.toolTip.AutoPopDelay = 0x1770; base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint), true); }
private Rectangle GetHeadRect(IOutlookBarBand var_symbol) { int num1 = this.selectorGroups.IndexOf(this.currentGroup); num1 = Math.Max(0, num1); int num2 = this.selectorGroups.IndexOf(var_symbol); if (num2 > num1) { num2 = this.selectorGroups.Count - num2; return new Rectangle(0, base.Height - (num2 * this.headHeight), base.Width, this.headHeight); } return new Rectangle(0, num2 * this.headHeight, base.Width, this.headHeight); }
//����һ�� private void DrawHeaders(Graphics g, IOutlookBarBand var_symbol) { if (var_symbol != null) { RectangleF ef1 = (RectangleF) this.GetHeadRect(var_symbol); Color color1 = this.titleColor; Color color2 = ControlPaint.LightLight(color1); Color color3 = ControlPaint.Dark(color1); g.FillRectangle(new SolidBrush(color2), ef1); using (GraphicsPath path1 = new GraphicsPath()) { ef1.Inflate(-1f, -1f); ef1.Width -= 1f; float single1 = 1f; float single2 = 1f; single1 = Math.Min((float) (ef1.Width / 2f), single1); single2 = Math.Min((float) (ef1.Height / 2f), single2); float single3 = (ef1.X + ef1.Width) - single1; path1.AddLine((float) (ef1.X + single1), ef1.Y, single3, ef1.Y); path1.AddArc((float) (single3 - single1), ef1.Y, (float) (single1 * 2f), (float) (single2 * 2f), (float) 270f, (float) 90f); float single4 = ef1.X + ef1.Width; float single5 = (ef1.Y + ef1.Height) - single2; path1.AddLine(single4, (float) (ef1.Y + single2), single4, single5); path1.AddArc((float) (single4 - (single1 * 2f)), (float) (single5 - single2), (float) (single1 * 2f), (float) (single2 * 2f), (float) 0f, (float) 90f); path1.AddLine((float) (single4 - single1), (float) (ef1.Y + ef1.Height), (float) (ef1.X + single1), (float) (ef1.Y + ef1.Height)); path1.AddArc(ef1.X, (float) (single5 - single2), (float) (single1 * 2f), (float) (single2 * 2f), (float) 90f, (float) 90f); path1.AddLine(ef1.X, single5, ef1.X, (float) (ef1.Y + single2)); path1.AddArc(ef1.X, ef1.Y, (float) (single1 * 2f), (float) (single2 * 2f), (float) 180f, (float) 90f); path1.CloseFigure(); using (Brush brush1 = new LinearGradientBrush(ef1, Color.White, color2, LinearGradientMode.Vertical)) { g.FillPath(brush1, path1); g.DrawPath(new Pen(color3), path1); using (StringFormat format1 = new StringFormat(StringFormat.GenericTypographic)) { format1.FormatFlags = StringFormatFlags.MeasureTrailingSpaces; format1.LineAlignment = StringAlignment.Center; g.DrawString(var_symbol.Id, SystemInformation.MenuFont, Brushes.Black, new RectangleF(ef1.X + 4f, ef1.Y + 2f, ef1.Width - 8f, ef1.Height - 4f), format1); } } } } }