Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Directives
- using System;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- #endregion
- #region Browse
- #region Browse
- /* Copyright & Contact
- * --------------------------------------------------------------------------------<
- * Tool Name : Notification Number *
- * From Project : Creator Eye *
- * 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.3 Beta *
- * Color : MultiColor + Gradient *
- * Style : Dark *
- *>--------------------------------------------------------------------------------<
- */
- /* Features
- * ------------------------
- * Value > Set The number of Notification you got at your application control
- * Maximum Value > The Maximum number are 99+
- */
- /* history
- * ------------------------
- * 1.1 (18 Jan 2018):
- * Add value (number) properties
- * Add maximum value (number) properties
- */
- #endregion
- #endregion
- #region Notification Number
- class Ce_NotificationNumber : Control
- {
- #region Variables
- private int _Value = 0;
- private int _Maximum = 99;
- #endregion
- #region Properties
- public int Value
- {
- get
- {
- if (this._Value == 0)
- {
- return 0;
- }
- return this._Value;
- }
- set
- {
- if (value > this._Maximum)
- {
- value = this._Maximum;
- }
- this._Value = value;
- this.Invalidate();
- }
- }
- public int Maximum
- {
- get
- {
- return this._Maximum;
- }
- set
- {
- if (value < this._Value)
- {
- this._Value = value;
- }
- this._Maximum = value;
- this.Invalidate();
- }
- }
- #endregion
- public Ce_NotificationNumber()
- {
- SetStyle(ControlStyles.SupportsTransparentBackColor, true);
- SetStyle(ControlStyles.UserPaint, true);
- Text = null;
- DoubleBuffered = true;
- }
- protected override void OnResize(EventArgs e)
- {
- base.OnResize(e);
- Height = 20;
- Width = 20;
- }
- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- var _G = e.Graphics;
- string myString = _Value.ToString();
- _G.Clear(BackColor);
- _G.SmoothingMode = SmoothingMode.AntiAlias;
- LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(18, 20)), Color.FromArgb(197, 69, 68), Color.FromArgb(176, 52, 52), 90f);
- // Fills the body with LGB gradient
- _G.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(18, 18)));
- // Draw border
- _G.DrawEllipse(new Pen(Color.FromArgb(205, 70, 66)), new Rectangle(new Point(0, 0), new Size(18, 18)));
- _G.DrawString(myString, new Font("Segoe UI", 8, FontStyle.Bold), new SolidBrush(Color.FromArgb(255, 255, 253)), new Rectangle(0, 0, Width - 2, Height), new StringFormat
- {
- Alignment = StringAlignment.Center,
- LineAlignment = StringAlignment.Center
- });
- e.Dispose();
- }
- }
- #endregion
Add Comment
Please, Sign In to add comment