/// <summary> /// Customs the aresio paint. /// </summary> /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param> private void CustomAresioPaint(System.Windows.Forms.PaintEventArgs e) { G.Clear(Parent.BackColor); G.DrawPath(DesignFunctions.ToPen(CustomAresioBorderColors[0]), DesignFunctions.RoundRect(0, 1, Width - 1, Height - 2, Curve)); G.DrawPath(DesignFunctions.ToPen(CustomAresioBorderColors[1]), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, Curve)); switch (Enabled) { case true: switch (State) { case MouseState.None: G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), CustomAresioNoneColors[0], CustomAresioNoneColors[1]), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, Curve)); break; case MouseState.Over: G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), CustomAresioOverColors[0], CustomAresioOverColors[1]), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, Curve)); break; case MouseState.Down: G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), CustomAresioDownColors[0], CustomAresioDownColors[1]), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, Curve)); break; } break; case false: //G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), Brushes.White, new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)) + 1, Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)) + 1)); //G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), Brushes.Gray, new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)), Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)))); break; } }
void Gray_PaintHook(System.Windows.Forms.PaintEventArgs e) { G.Clear(Color.FromArgb(51, 51, 51)); G.SmoothingMode = SmoothingMode.AntiAlias; G.FillPath(DesignFunctions.ToBrush(20, 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 (int 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)); } }
private void GrayPaint() { G.Clear(Parent.BackColor); LinearGradientBrush BackgroundGradient = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.Transparent, Color.Transparent); switch (State) { case MouseState.None: BackgroundGradient.LinearColors = new Color[] { Color.FromArgb(127, 127, 127), Color.FromArgb(93, 93, 93) }; break; case MouseState.Over: BackgroundGradient.LinearColors = new Color[] { Color.FromArgb(75, 130, 195), Color.FromArgb(40, 80, 135) }; break; case MouseState.Down: BackgroundGradient.LinearColors = new Color[] { Color.FromArgb(55, 110, 175), Color.FromArgb(40, 80, 135) }; break; } G.FillPath(BackgroundGradient, DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 3)); G.DrawLine(DesignFunctions.ToPen(100, Color.White), new Point(2, 1), new Point(Width - 3, 1)); 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)); BackgroundGradient.Dispose(); //G.DrawString(Text, new Font(Font.Name, Font.Size, FontStyle.Bold), Brushes.Black, new Rectangle(0, 0, Width - 1, Height - 1), new StringFormat //{ // LineAlignment = StringAlignment.Center, // Alignment = StringAlignment.Center //}); //G.DrawString(Text, new Font(Font.Name, Font.Size, FontStyle.Bold), Brushes.White, new Rectangle(0, 1, Width - 1, Height - 1), new StringFormat //{ // LineAlignment = StringAlignment.Center, // Alignment = StringAlignment.Center //}); }
private void SkyBasePaint(System.Windows.Forms.PaintEventArgs e) { B = new Bitmap(Width, Height); G = Graphics.FromImage(B); LinearGradientBrush G1 = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), skyBaseC3, skyBaseC4); G.FillRectangle(G1, 0, 0, Width, Height); G1.Dispose(); if (Enabled) { switch (State) { case MouseState.Over: G.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), new Rectangle(0, 0, Width, Height)); break; case MouseState.Down: G.FillRectangle(new SolidBrush(Color.FromArgb(10, Color.Black)), new Rectangle(0, 0, Width, Height)); break; } } StringFormat S1 = new StringFormat(); S1.LineAlignment = StringAlignment.Center; S1.Alignment = StringAlignment.Center; //switch (Enabled) //{ // case true: // G.DrawString(Text, Font, DesignFunctions.ToBrush(113, 170, 186), new Rectangle(0, 0, Width - 1, Height - 1), S1); // break; // case false: // G.DrawString(Text, Font, Brushes.Gray, new Rectangle(0, 0, Width - 1, Height - 1), S1); // break; //} S1.Dispose(); G.DrawRectangle(DesignFunctions.ToPen(skyBaseC1), 0, 0, Width - 1, Height - 1); G.DrawRectangle(DesignFunctions.ToPen(skyBaseC2), 1, 1, Width - 3, Height - 3); e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); //G.Dispose(); //B.Dispose(); }
/// <summary> /// Grays the on paint. /// </summary> /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param> private void GrayOnPaint(System.Windows.Forms.PaintEventArgs e) { //Bitmap B = new Bitmap(Width, Height); Graphics G = e.Graphics; G.SmoothingMode = Smoothing; G.Clear(Parent.BackColor); dynamic progressWidth = Convert.ToInt32(Value * (1 / Maximum) * Width); 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, progressWidth - 1, Height - 3, 3)); G.DrawPath(DesignFunctions.ToPen(150, Color.Black), DesignFunctions.RoundRect(0, 1, progressWidth - 1, Height - 3, 3)); if (Value > 0) { G.SmoothingMode = SmoothingMode.AntiAlias; G.SetClip(DesignFunctions.RoundRect(0, 0, progressWidth - 1, Height - 1, 3)); for (int i = 0; i <= progressWidth - 1; i += 25) { G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(35, Color.White)), 10), 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(Convert.ToInt32((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)); //e.Graphics.DrawImage(B, 0, 0); //G.Dispose(); //B.Dispose(); }
private void AresioPaint(System.Windows.Forms.PaintEventArgs e) { //Graphics G = e.Graphics; G.SmoothingMode = Smoothing; G.Clear(BackColor); //Background G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(250, 200, 70), Color.FromArgb(250, 160, 40)), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4)); G.DrawPath(DesignFunctions.ToPen(50, Color.White), DesignFunctions.RoundRect(0, 1, Width - 1, Height - 2, 4)); G.DrawPath(DesignFunctions.ToPen(150, 100, 70), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4)); switch (Enabled) { case true: switch (State) { case MouseState.Over: G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(50, Color.White), Color.Transparent), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4)); break; case MouseState.Down: G.FillPath(new LinearGradientBrush(new Point(0, 0), new Point(0, Height), Color.FromArgb(50, Color.Black), Color.Transparent), DesignFunctions.RoundRect(0, 0, Width - 1, Height - 1, 4)); break; } //G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), DesignFunctions.ToBrush(100, Color.White), new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)), Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)) + 1)); //G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), DesignFunctions.ToBrush(200, Color.Black), new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)), Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)))); break; case false: //G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), Brushes.White, new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)) + 1, Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)) + 1)); //G.DrawString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular), Brushes.Gray, new Point(Convert.ToInt32((Width / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Width / 2)), Convert.ToInt32((Height / 2) - (G.MeasureString(Text, new Font(Font.FontFamily, Font.Size, FontStyle.Regular)).Height / 2)))); break; } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param> private void AresioOnPaint(System.Windows.Forms.PaintEventArgs e) { Graphics G = e.Graphics; Rectangle aresioBar = new Rectangle(10, 10, Width - 21, Height - 21); G.Clear(Parent.BackColor); G.SmoothingMode = SmoothingMode.AntiAlias; DesignFunctions.PillStyle styles = new DesignFunctions.PillStyle(); styles.Left = true; styles.Right = true; //Background LinearGradientBrush BackLinear = new LinearGradientBrush(new Point(0, Convert.ToInt32((Height / 2) - (Track.Height / 2))), new Point(0, Convert.ToInt32((Height / 2) + (Track.Height / 2))), Color.FromArgb(50, Color.Black), Color.Transparent); //G.FillPath(BackLinear, RoundRect(0, CInt((Height / 2) - 4), Width - 1, 8, 3)) G.FillPath(BackLinear, (GraphicsPath)DesignFunctions.Pill(0, Convert.ToInt32(Height / 2 - Track.Height / 2), Width - 1, Track.Height - 2, new DesignFunctions.PillStyle { Left = true, Right = true })); G.FillPath(BackLinear, (GraphicsPath)DesignFunctions.Pill(0, Convert.ToInt32(Height / 2 - Track.Height / 2), Width - 1, Track.Height - 2, new DesignFunctions.PillStyle { Left = true, Right = true })); G.DrawPath(DesignFunctions.ToPen(50, Color.Black), (GraphicsPath)DesignFunctions.Pill(0, Convert.ToInt32(Height / 2 - Track.Height / 2), Width - 1, Track.Height - 2, new DesignFunctions.PillStyle { Left = true, Right = true })); BackLinear.Dispose(); //Fill if (ToggleLocation > 0) { G.FillPath(new LinearGradientBrush(new Point(0, Convert.ToInt32((Height / 2) - Track.Height / 2)), new Point(1, Convert.ToInt32((Height / 2) + Track.Height / 2)), Color.FromArgb(250, 200, 70), Color.FromArgb(250, 160, 40)), (GraphicsPath)DesignFunctions.Pill(1, Convert.ToInt32((Height / 2) - Track.Height / 2), Convert.ToInt32(aresioBar.Width * (ToggleLocation / 100)) + Convert.ToInt32(Track.Width / 2), Track.Height - 3, new DesignFunctions.PillStyle { Left = true, Right = true })); G.DrawPath(DesignFunctions.ToPen(100, Color.White), (GraphicsPath)DesignFunctions.Pill(1, Convert.ToInt32((Height / 2) - Track.Height / 2 + 1), Convert.ToInt32(aresioBar.Width * (ToggleLocation / 100)) + Convert.ToInt32(Track.Width / 2), Track.Height - 5, new DesignFunctions.PillStyle { Left = true, Right = true })); } if (Checked) { G.DrawString("ON", new Font("Arial", 6, FontStyle.Bold), DesignFunctions.ToBrush(150, Color.Black), new Rectangle(0, -1, Width - Track.Width + Track.Width / 3, Height), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); } else { G.DrawString("OFF", new Font("Arial", 6, FontStyle.Bold), DesignFunctions.ToBrush(150, Color.Black), new Rectangle(Track.Width - Track.Width / 3, -1, Width - Track.Width + Track.Width / 3, Height), new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); } //Button G.FillEllipse(Brushes.White, aresioBar.X + Convert.ToInt32(aresioBar.Width * (ToggleLocation / 100)) - Convert.ToInt32(Track.Width / 2), aresioBar.Y + Convert.ToInt32((aresioBar.Height / 2)) - Convert.ToInt32(Track.Height / 2), Track.Width, Track.Height); G.DrawEllipse(DesignFunctions.ToPen(50, Color.Black), aresioBar.X + Convert.ToInt32(aresioBar.Width * (ToggleLocation / 100) - Convert.ToInt32(Track.Width / 2)), aresioBar.Y + Convert.ToInt32((aresioBar.Height / 2)) - Convert.ToInt32(Track.Height / 2), Track.Width, Track.Height); }
private void panel1_MouseDown(object sender, MouseEventArgs e) { DesignFunctions.MoveControl(this); }