protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e) { try { base.OnDrawColumnHeader(e); string key = this.Columns[e.ColumnIndex].ImageKey; if (!string.IsNullOrEmpty(key)) { Rectangle rect = e.Bounds; int offset = 3; Size arrowSize = new System.Drawing.Size(8, 6); Rectangle sortRect = new Rectangle(rect.Right - offset - arrowSize.Width, rect.Y + (rect.Height - arrowSize.Height) / 2, arrowSize.Width, arrowSize.Height); Graphics g = e.Graphics; GDIHelper.InitializeGraphics(g); Color c = Color.FromArgb(46, 117, 35); if (key == "up") { GDIHelper.DrawArrow(g, ArrowDirection.Up, sortRect, arrowSize, 1.5f, c); } else { GDIHelper.DrawArrow(g, ArrowDirection.Down, sortRect, arrowSize, 1.5f, c); } } }catch {} }
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) { Size arrowSize = new Size(8, 8); Graphics g = e.Graphics; GDIHelper.InitializeGraphics(g); Rectangle rect = e.ArrowRectangle; rect.X -= 2; GDIHelper.DrawArrow(g, e.Direction, rect, arrowSize); }
protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e) { base.OnRenderOverflowButtonBackground(e); Graphics g = e.Graphics; GDIHelper.InitializeGraphics(g); ToolStripItem item = e.Item; Rectangle rect = item.Bounds; rect = new Rectangle(0, 0, rect.Width, rect.Height); Size arrowSize = new Size(8, 8); GDIHelper.DrawArrow(g, ArrowDirection.Down, rect, arrowSize); }
/// <summary> /// 绘制按钮 /// </summary> /// <param name="g">The Graphics.</param> /// User:Ryan CreateTime:2011-08-02 14:23. private void DrawButton(Graphics g) { Rectangle btnRect; EnumControlState btnState = this.GetComboBoxButtonPressed() ? EnumControlState.HeightLight : EnumControlState.Default; btnRect = new Rectangle(this.ButtonRect.X, this.ButtonRect.Y - 1, this.ButtonRect.Width + 1 + this._Margin, this.ButtonRect.Height + 2); RoundRectangle btnRoundRect = new RoundRectangle(btnRect, new CornerRadius(0)); //Blend blend = new Blend(3); //blend.Positions = new float[] { 0f, 0.5f, 1f }; //blend.Factors = new float[] { 0f, 1f, 0f }; GDIHelper.FillRectangle(g, btnRoundRect, SkinManager.CurrentSkin.DefaultControlColor); Size btnSize = new Size(12, 7); GDIHelper.DrawArrow(g, ArrowDirection.Down, btnRect, btnSize, 0f, Color.FromArgb(30, 178, 239)); Color lineColor = SkinManager.CurrentSkin.BorderColor; GDIHelper.DrawGradientLine(g, lineColor, 90, btnRect.X, btnRect.Y, btnRect.X, btnRect.Bottom - 1); }