protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); foreach (ListViewItem item in this.Items) { Rectangle itemRect = new Rectangle(item.Position.X + 1, item.Position.Y + 1, this.TileSize.Width - 2, this.TileSize.Height - 2); Rectangle labelRect = new Rectangle(item.Position.X + 1, item.Position.Y + this.TileSize.Height - 21, this.TileSize.Width - 2, 20); if (this.LargeImageList != null) { if (item.ImageIndex < this.LargeImageList.Images.Count && item.ImageIndex >= 0) { e.Graphics.DrawImageUnscaledAndClipped(this.LargeImageList.Images[item.ImageIndex], itemRect); } } if (item.Selected) { e.Graphics.FillRectangle(ColorTheme.Brush(Color.FromArgb(30, ColorTheme.ThemeColor.R, ColorTheme.ThemeColor.G, ColorTheme.ThemeColor.B)), itemRect); e.Graphics.DrawRectangle(ColorTheme.Pen(ColorTheme.ThemeColor), itemRect); e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.ThemeColor), labelRect); e.Graphics.DrawString(item.Text, this.Font, ColorTheme.Brush(ColorTheme.ControlBackgroundColor), new PointF(item.Position.X + 5, labelRect.Y + 3)); } else { e.Graphics.DrawRectangle(ColorTheme.Pen(ColorTheme.SeparatorShadowColor), itemRect); e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.SeparatorShadowColor), labelRect); e.Graphics.DrawString(item.Text, this.Font, ColorTheme.Brush(ColorTheme.FontColor), new PointF(item.Position.X + 5, labelRect.Y + 3)); } } }
protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e) { ToolStripButton item = ( ToolStripButton )e.Item; Rectangle rect = new Rectangle(Point.Empty, item.Size); Rectangle rectFrame = new Rectangle(Point.Empty, new Size(item.Width - 1, item.Height - 1)); if (item.Checked) { e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.DropDownItemColor), rect); if (item.Selected) { e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.ItemSelectColor), rect); } e.Graphics.DrawRectangle(ColorTheme.Pen(ColorTheme.ThemeColor), rectFrame); } else if (item.Selected) { e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.ItemSelectColor), rect); } else { base.OnRenderMenuItemBackground(e); } if (item.Pressed) { e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.DropDownItemColor), rect); } }
protected override void OnPaint(PaintEventArgs e) { Rectangle frameRect = new Rectangle(1, 1, 12, 12); Rectangle borderRect = new Rectangle(0, 0, 14, 14); SizeF textSize = e.Graphics.MeasureString(this.Text, this.Font); e.Graphics.FillRectangle(ColorTheme.Brush(this.BackColor), e.ClipRectangle); e.Graphics.DrawString(this.Text, this.Font, ColorTheme.Brush(this.ForeColor), new PointF(6, 0)); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(1, 8), new Point(5, 8)); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(( int )textSize.Width + 7, 8), new Point(this.Width - 2, 8)); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(0, 9), new Point(0, this.Height - 2)); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(1, this.Height - 1), new Point(this.Width - 2, this.Height - 1)); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(this.Width - 1, 9), new Point(this.Width - 1, this.Height - 2)); }
protected override void OnPaint(PaintEventArgs e) { Point center = new Point( ( int )(this.Width - e.Graphics.MeasureString(this.Text, this.Font).Width) / 2, ( int )(this.Height - this.Font.Height) / 2); if (this.Enabled) { if (this.hovering) { e.Graphics.FillRectangle(this.background_h, e.ClipRectangle); } else { e.Graphics.FillRectangle(this.background_i, e.ClipRectangle); } if (this.pressed) { e.Graphics.FillRectangle(this.background_p, e.ClipRectangle); e.Graphics.DrawRectangle(ColorTheme.Pen(ColorTheme.BackgroundColor), new Rectangle(1, 1, this.Width - 3, this.Height - 3)); } else { e.Graphics.DrawRectangle(ColorTheme.Pen(ColorTheme.BackgroundColor), new Rectangle(1, 1, this.Width - 3, this.Height - 3)); } e.Graphics.DrawRectangle(ColorTheme.Pen(ColorTheme.ThemeColor), new Rectangle(0, 0, this.Width - 1, this.Height - 1)); e.Graphics.DrawString(this.Text, this.Font, ColorTheme.Brush(ColorTheme.FontColor), center); } else { e.Graphics.FillRectangle(this.background_i, e.ClipRectangle); e.Graphics.DrawString(this.Text, this.Font, ColorTheme.Brush(ColorTheme.SeparatorShadowColor), center); } if (this.Image != null) { e.Graphics.DrawImage(this.Image, new Point(center.X - this.Image.Width / 2, center.Y - 4)); } }
protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) { Rectangle rect = new Rectangle(Point.Empty, e.Item.Size); int middleY = ((rect.Top + rect.Bottom) / 2 + 1); int middleX = ((rect.Left + rect.Right) / 2 + 2); if (e.Item.IsOnDropDown) { e.Item.AutoSize = false; e.Item.Size = new Size(e.Item.Size.Width, 3); e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.DropDownItemColor), rect); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.SeparatorColor), 30, middleY - 1, rect.Width, middleY - 1); } else { e.Graphics.FillRectangle(ColorTheme.Brush(ColorTheme.BackgroundColor), rect); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.SeparatorColor), middleX, 5, middleX, rect.Height - 5); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.SeparatorShadowColor), middleX - 1, 5, middleX - 1, rect.Height - 5); } }
protected override void OnPaint(PaintEventArgs e) { Rectangle frameRect = new Rectangle(1, 1, 12, 12); Rectangle borderRect = new Rectangle(0, 0, 14, 14); e.Graphics.FillRectangle(ColorTheme.Brush(this.BackColor), e.ClipRectangle); e.Graphics.DrawString(this.Text, this.Font, ColorTheme.Brush(this.ForeColor), new PointF(20, 0)); if (this.Enabled) { if (this.hovering) { e.Graphics.DrawRectangle(ColorTheme.Pen(Color.FromArgb(255, ColorTheme.ThemeColor.R / 2, ColorTheme.ThemeColor.G / 2, ColorTheme.ThemeColor.B / 2)), borderRect); } else { e.Graphics.DrawRectangle(ColorTheme.Pen(ColorTheme.ThemeColor), frameRect); } } else { e.Graphics.DrawRectangle(ColorTheme.Pen(disabledFrameColor), frameRect); } if (this.Checked) { if (this.Enabled) { e.Graphics.DrawImageUnscaledAndClipped(Resources.checkbox_checked, new Rectangle(2, 2, 11, 11)); } else { e.Graphics.DrawImageUnscaledAndClipped(Resources.checkbox_checked_disabled, new Rectangle(2, 2, 11, 11)); } } }
protected override void OnPaint(PaintEventArgs e) { e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(0, this.guiPanelTitle.Height), new Point(0, this.Height)); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(0, this.Height - 1), new Point(this.Width, this.Height - 1)); e.Graphics.DrawLine(ColorTheme.Pen(ColorTheme.ThemeColor), new Point(this.Width - 1, this.guiPanelTitle.Height), new Point(this.Width - 1, this.Height)); }