Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Copyright & Contact
- // Creator : Yassine Abbani
- // Pastebin : https://pastebin.com/u/Yassine_Abbani
- // Facebook: https://wwww.facebook.com/yassineabbani.user
- #endregion
- #region Import
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Drawing;
- using System.Data;
- using System.Windows.Forms;
- #endregion
- #region Gradient Panel
- public class Ce_Gradient_Panel : System.Windows.Forms.Panel
- {
- #region Installing
- #region Add Panel Information
- private Color color1 = Color.SteelBlue;
- private Color color2 = Color.DarkBlue;
- private int color1Transparent = 150;
- private int color2Transparent = 150;
- private int angle = 90;
- #endregion
- #region Draw
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- Color c1 = Color.FromArgb(color1Transparent, color1);
- Color c2 = Color.FromArgb(color2Transparent, color2);
- Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c1, c2, angle);
- //fill rectangle with panel size
- e.Graphics.FillRectangle(b, ClientRectangle);
- b.Dispose();
- }
- #endregion
- #region Ce_Gradient_Panel Return
- public Ce_Gradient_Panel()
- {
- }
- #endregion
- #endregion
- #region Properties
- //Create Properties
- #region Top Color
- public Color GradientTopColor {
- get { return color1; }
- set { color1 = value; Invalidate(); }
- }
- #endregion
- #region Transparent On Top
- public int GradientTopTransparent
- {
- get { return color1Transparent; }
- set
- {
- color1Transparent = value;
- if (color1Transparent > 255)
- {
- color1Transparent = 255;
- Invalidate();
- }
- else
- Invalidate();
- }
- }
- #endregion
- #region Buttom Color
- public Color GradientBottomColor
- {
- get { return color2; }
- set { color2 = value; Invalidate(); }
- }
- #endregion
- #region Transparent On Buttom
- public int GradientBottomTransparent
- {
- get { return color2Transparent; }
- set
- {
- color2Transparent = value;
- if (color2Transparent > 255)
- {
- color2Transparent = 255;
- Invalidate();
- }
- else
- Invalidate();
- }
- }
- #endregion
- #region Gradient Angle
- public int GradientAngle
- {
- get { return angle; }
- set { angle = value; Invalidate(); }
- }
- #endregion
- #endregion
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement