Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Derectives
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Drawing;
- using System.Data;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- #endregion
- #region Browse
- /* Copyright & Contact
- * --------------------------------------------------------------------------------<
- * Tool Name : Label *
- * From Project : Creator Eye *
- * Project Lang : C# *
- * Creator : Yassine Abbani *
- * Facebook : https://www.facebook.com/YassineAbbani.user *
- * Pastebin : https://pastebin.com/u/Yassine_Abbani *
- * Youtube : https://www.youtube.com/channel/UCqvOCRs3HWbPH4yuZuTx8mw *
- * Version : 1.0 Beta *
- * Color : Multi Color *
- * Style : Gradient *
- *>--------------------------------------------------------------------------------<
- */
- /* Features
- * ------------------------
- * Custom Properties:
- * Add Gradient Top Color
- * Add Transparent Effect to Top Color
- * Add Transparent Effect to bottom Color
- * Add Gradient Angel
- */
- /* history
- * ------------------------
- * 1.0 (23 Feb 2018):
- * This Costume Control Was Designed By Creator Eye UI for add that label to her library
- * Created by using Simple Commands
- *
- */
- #endregion
- class CeGradientLabel : System.Windows.Forms.Label
- {
- #region Variables
- private Color colorA = Color.LightGreen;
- private Color colorB = Color.DarkBlue;
- private int colorATransparent = 0;
- private int colorBTransparent = 0;
- private int angle = 90;
- private String text = "CreatorEye Label";
- #endregion
- #region Properties
- public String DisplayText
- {
- get { return text; }
- set { text = value; Invalidate(); }
- }
- public Color TopColor
- {
- get { return colorA; }
- set { colorA = value; Invalidate(); }
- }
- public Color ButtomColor
- {
- get { return colorB; }
- set { colorB = value; Invalidate(); }
- }
- public int TopColorTransparent
- {
- get { return colorATransparent; }
- set
- {
- colorATransparent = value;
- if (colorATransparent > 255)
- {
- colorATransparent = 255;
- Invalidate();
- }
- else
- Invalidate();
- }
- }
- public int ButtomColorTransparent
- {
- get { return colorBTransparent; }
- set
- {
- colorBTransparent = value;
- if (colorBTransparent > 255)
- {
- colorBTransparent = 255;
- Invalidate();
- }
- else
- Invalidate();
- }
- }
- public int GradientAngle
- {
- get { return angle; }
- set { angle = value; Invalidate(); }
- }
- #endregion
- #region Constructors
- public CeGradientLabel()
- {
- this.ForeColor = Color.Transparent;
- }
- #endregion
- #region Draw Control
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- this.Text = text;
- Color c1 = Color.FromArgb(colorATransparent, colorA);
- Color c2 = Color.FromArgb(colorBTransparent, colorB);
- Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, 50, 50), c1, c2, angle);
- e.Graphics.DrawString(this.Text, this.Font, b, new Point(0, 0));
- }
- #endregion
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement