protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); Graphics G = e.Graphics; G.SmoothingMode = SmoothingMode.AntiAlias; if (Checked) { G.FillEllipse(new LinearGradientBrush(new Point(Height / 2, 0), new Point(Height / 2, Height), Color.FromArgb(75, 130, 195), Color.FromArgb(40, 80, 135)), new Rectangle(0, 0, Height - 1, Height - 1)); G.FillEllipse(DesignFunctions.ToBrush(150, Color.Black), new Rectangle(4, 4, Height - 9, Height - 9)); } else { if (MouseState == State.Over) { G.FillEllipse(new LinearGradientBrush(new Point(Height / 2, 0), new Point(Height / 2, Height), Color.FromArgb(75, 130, 195), Color.FromArgb(40, 80, 135)), new Rectangle(0, 0, Height - 1, Height - 1)); } else { G.FillEllipse(new LinearGradientBrush(new Point(Height / 2, 0), new Point(Height / 2, Height), Color.FromArgb(127, 127, 127), Color.FromArgb(93, 93, 93)), new Rectangle(0, 0, Height - 1, Height - 1)); } } G.DrawEllipse(DesignFunctions.ToPen(50, Color.White), new Rectangle(0, 1, Height - 1, Height - 2)); G.DrawEllipse(Pens.Black, new Rectangle(0, 0, Height - 1, Height - 1)); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); Graphics G = e.Graphics; G.Clear(Parent.BackColor); G.FillPath(DesignFunctions.ToBrush(85, 85, 85), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 3)); LinearGradientBrush BackgroundGradient = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(75, 130, 195), Color.FromArgb(40, 80, 135)); G.FillPath(BackgroundGradient, DesignFunctions.RoundRect(0, 1, (Width - 1) * _value / _maximum, Height - 3, 3)); G.DrawPath(DesignFunctions.ToPen(150, Color.Black), DesignFunctions.RoundRect(0, 1, (Width - 1) * _value / _maximum, Height - 3, 3)); if (_value > 0) { G.SmoothingMode = SmoothingMode.AntiAlias; G.SetClip(DesignFunctions.RoundRect(0, 0, (Width - 1) * _value / _maximum - 1, Height - 1, 3)); for (var i = 0; i <= (Width - 1) * _value / _maximum; i += 25) { G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(35, Color.White)), 10F), new Point(i, 0 - 5), new Point(i + 25, Height + 10)); } G.ResetClip(); G.DrawLine(DesignFunctions.ToPen(100, Color.White), new Point(2, 1), new Point((Width - 3) * _value / _maximum - 3, 1)); G.SmoothingMode = SmoothingMode.None; } G.DrawPath(Pens.Gray, DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 3)); G.DrawPath(Pens.Black, DesignFunctions.RoundRect(0, 0, Width - 1, Height - 2, 3)); }
public void ReplaceItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { e.DrawBackground(); Graphics G = e.Graphics; try { G.FillRectangle(DesignFunctions.ToBrush(95, 95, 95), e.Bounds); G.DrawString(base.GetItemText(base.Items[e.Index]), e.Font, Brushes.LightGray, new Rectangle(e.Bounds.X + 4, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), new StringFormat { LineAlignment = StringAlignment.Center }); if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { LinearGradientBrush BackgroundGradient = new LinearGradientBrush(new Point(e.Bounds.X, e.Bounds.Y), new Point(e.Bounds.X, e.Bounds.Y + e.Bounds.Height - 1), Color.FromArgb(75, 130, 195), Color.FromArgb(40, 80, 135)); G.FillPath(BackgroundGradient, DesignFunctions.RoundRect(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1, 3)); G.DrawLine(DesignFunctions.ToPen(100, Color.White), new Point(e.Bounds.X, e.Bounds.Y + 1), new Point(e.Bounds.Width - 1, e.Bounds.Y + 1)); G.DrawPath(Pens.Gray, DesignFunctions.RoundRect(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1, 3)); G.DrawPath(Pens.Black, DesignFunctions.RoundRect(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 2, 3)); G.DrawString(base.GetItemText(base.Items[e.Index]), e.Font, Brushes.White, new Rectangle(e.Bounds.X + 4, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), new StringFormat { LineAlignment = StringAlignment.Center }); } } catch { //Uh oh } }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); Graphics G = e.Graphics; G.Clear(Parent.BackColor); G.SmoothingMode = SmoothingMode.AntiAlias; G.FillPath(DesignFunctions.ToBrush(10, Color.Black), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 2, 5)); G.DrawPath(DesignFunctions.ToPen(50, Color.White), DesignFunctions.RoundRect(-1, -4, Width + 1, Height + 3, 5)); G.DrawPath(DesignFunctions.ToPen(50, Color.Black), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 2, 5)); for (var i = 0; i <= 10; i++) { G.DrawPath(DesignFunctions.ToPen(50 / (i + 1), Color.Black), DesignFunctions.RoundRect(i, i, Width - 1 - (i * 2), Height - 2 - (i * 2), 5)); } }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); Graphics G = e.Graphics; G.Clear(BackColor); //Border G.DrawRectangle(Pens.DimGray, new Rectangle(1, 1, Width - 3, Height - 3)); G.DrawPath(Pens.Black, DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 2)); //Title G.FillRectangle(DesignFunctions.ToBrush(78, 78, 78), new Rectangle(1, 1, Width - 2, 19)); G.FillRectangle(DesignFunctions.ToBrush(20, Color.White), new Rectangle(1, 1, Width - 2, 10)); G.DrawLine(DesignFunctions.ToPen(150, Color.Black), new Point(1, 19), new Point(Width - 2, 19)); G.DrawLine(DesignFunctions.ToPen(50, Color.White), new Point(1, 20), new Point(Width - 2, 20)); //Title Icon try { G.DrawIcon(_ico, new Rectangle(3, 3, 16, 16)); } catch (Exception ex) { MessageBox.Show(ex.Message); } //Title Text G.DrawString(Text, Font, DesignFunctions.ToBrush(120, Color.Black), new Rectangle(1, 0, Width - 2, 19), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); G.DrawString(Text, Font, DesignFunctions.ToBrush(ForeColor), new Rectangle(1, 1, Width - 2, 19), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); try { G.DrawRectangle(DesignFunctions.ToPen(Parent.FindForm().TransparencyKey), new Rectangle(0, 0, 1, 1)); G.DrawRectangle(DesignFunctions.ToPen(Parent.FindForm().TransparencyKey), new Rectangle(Width - 1, 0, 1, 1)); G.DrawRectangle(DesignFunctions.ToPen(Parent.FindForm().TransparencyKey), new Rectangle(0, Height - 1, 1, 1)); G.DrawRectangle(DesignFunctions.ToPen(Parent.FindForm().TransparencyKey), new Rectangle(Width - 1, Height - 1, 1, 1)); } catch (Exception ex) { MessageBox.Show(ex.Message); } G.SmoothingMode = SmoothingMode.AntiAlias; if ((new Rectangle(Width - 20, 5, 10, 10)).Contains(PointToClient(MousePosition))) { G.DrawLine(new Pen(Brushes.White, 2F), new Point(Width - 20, 7), new Point(Width - 13, 13)); G.DrawLine(new Pen(Brushes.White, 2F), new Point(Width - 20, 13), new Point(Width - 13, 7)); if (MouseButtons == MouseButtons.Left) { G.DrawLine(new Pen(Brushes.DarkGray, 2F), new Point(Width - 20, 7), new Point(Width - 13, 13)); G.DrawLine(new Pen(Brushes.DarkGray, 2F), new Point(Width - 20, 13), new Point(Width - 13, 7)); } } else { G.DrawLine(new Pen(Brushes.Gray, 2F), new Point(Width - 20, 7), new Point(Width - 13, 13)); G.DrawLine(new Pen(Brushes.Gray, 2F), new Point(Width - 20, 13), new Point(Width - 13, 7)); } }