protected override void OnDrawItemHeader(DrawHeaderArgs e) { if (e.HeaderHeight < 1) { return; } int y = e.HeaderHeight - e.TitleBarHeight; #region erase corners if (e.HasParent) { e.ParentRectangle.Offset(-e.Location.X, -e.Location.Y); this.DrawBarBackground(e.Graphics, e.ParentRectangle, new Rectangle(0, 0, e.ItemBounds.Width, e.HeaderHeight)); } else { e.Graphics.FillRectangle(SystemBrushes.Control, 0, 0, e.ItemBounds.Width, e.HeaderHeight); } #endregion #region draw backgrounds if (e.Special) { this._blnd.Colors = this._colors[1]; } else { this._blnd.Colors = this._colors[0]; } #region draw horizontal this._blnd.Positions = this._positions[0]; this._lnbrs.InterpolationColors = this._blnd; this._lnbrs.Transform = new Matrix((float)e.ItemBounds.Width, 0f, 0f, 1f, 0f, (float)y); e.Graphics.FillRectangle(this._lnbrs, 0, y, e.ItemBounds.Width, e.TitleBarHeight); #endregion #region draw vertical this._blnd.Colors = this._colors[2]; this._blnd.Positions = _positions[1]; this._lnbrs.InterpolationColors = this._blnd; this._lnbrs.Transform = new Matrix(0f, e.TitleBarHeight, 1f, 0f, 0f, (float)y); e.Graphics.FillRectangle(this._lnbrs, 0, y, e.ItemBounds.Width, e.TitleBarHeight); #endregion #endregion #region draw outline this._pn.Color = _colors[5][0]; e.Graphics.DrawLines(this._pn, new Point[] { new Point(0, y + e.TitleBarHeight - 1), new Point(0, y), new Point(e.ItemBounds.Right - 1, y), new Point(e.ItemBounds.Right - 1, y + e.TitleBarHeight - 1) }); this._pn.Color = _colors[5][1]; e.Graphics.DrawRectangle(this._pn, 1, y + 1, e.ItemBounds.Width - 3, e.TitleBarHeight - 2); #endregion int stringoffx = 16; if (e.TitleImage != null) { e.Graphics.DrawImageUnscaled(e.TitleImage, 1, 0); stringoffx = Math.Max(16, e.TitleImage.Width); } #region draw string / button e.Graphics.DrawString(e.Caption, this._fnt, Brushes.White, new Rectangle(stringoffx, y + 1, e.ItemBounds.Width - (stringoffx + 26), e.TitleBarHeight), this._fmt); if (e.Collapsed) { DrawArrowDown(e.Graphics, e.ItemBounds.Right - 18, y + e.TitleBarHeight / 2 - 1); } else { DrawArrowUp(e.Graphics, e.ItemBounds.Right - 18, y + e.TitleBarHeight / 2 - 3); } #endregion }
protected override void OnDrawItemHeader(DrawHeaderArgs e) { if(e.HeaderHeight<1) return; int y=e.HeaderHeight-e.TitleBarHeight; #region erase corners if (e.HasParent) { e.ParentRectangle.Offset(-e.Location.X,-e.Location.Y); this.DrawBarBackground(e.Graphics, e.ParentRectangle, new Rectangle(0,0,e.ItemBounds.Width,e.HeaderHeight)); } else { e.Graphics.FillRectangle(SystemBrushes.Control,0,0,e.ItemBounds.Width,e.HeaderHeight); } #endregion #region draw backgrounds if (e.Special) { this._blnd.Colors=this._colors[0]; this._pn.Color=this._colors[3][0]; } else { this._blnd.Colors=this._colors[1]; this._pn.Color=this._colors[3][1]; } this._blnd.Positions=this._positions[0]; this._lnbrs.InterpolationColors=this._blnd; this._lnbrs.Transform=new Matrix(0f,(float)e.TitleBarHeight,1f,0f,1f,(float)y); e.Graphics.FillRectangle(this._lnbrs,1,y+1,e.ItemBounds.Width-1,e.TitleBarHeight-1); #endregion #region draw outline if (e.HasParent) { e.Graphics.DrawLines(this._pn,new Point[] { new Point(0,y+e.TitleBarHeight), new Point(0,y+1), new Point(1,y), new Point(e.ItemBounds.Right-2,y), new Point(e.ItemBounds.Right-1,y+1), new Point(e.ItemBounds.Right-1,y+e.TitleBarHeight) }); } else { e.Graphics.DrawLines(this._pn,new Point[] { new Point(0,y+e.TitleBarHeight), new Point(0,y), new Point(e.ItemBounds.Right-1,y), new Point(e.ItemBounds.Right-1,y+e.TitleBarHeight) }); } #endregion int stringoffx=16; if (e.TitleImage!=null) { e.Graphics.DrawImageUnscaled(e.TitleImage,1,0); stringoffx=Math.Max(16,e.TitleImage.Width); } #region draw string / button if (e.MouseCapture) this._slbrs.Color=this._colors[3][3]; else this._slbrs.Color=this._colors[3][2]; e.Graphics.DrawString(e.Caption,this._fnt,this._slbrs, new Rectangle(stringoffx,y+1,e.ItemBounds.Width-(stringoffx+26),e.TitleBarHeight),this._fmt); if (e.Collapsed) { DrawArrowDown(e.Graphics,e.ItemBounds.Right-18,y+e.TitleBarHeight/2-4); DrawArrowDown(e.Graphics,e.ItemBounds.Right-18,y+e.TitleBarHeight/2); } else { DrawArrowUp(e.Graphics,e.ItemBounds.Right-18,y+e.TitleBarHeight/2-5); DrawArrowUp(e.Graphics,e.ItemBounds.Right-18,y+e.TitleBarHeight/2-1); } #endregion }
protected abstract void OnDrawItemHeader(DrawHeaderArgs e);
public void DrawItemHeader(DrawHeaderArgs e) { if (e.IsEmpty()) return; this.OnDrawItemHeader(e); }