Lower a Form's Opacity as the due date aproaches until it disappears completely!
This class library adds a extension method to a Windows.Forms.Form
which lowers the Form.Opacity
based on how close DateTime.Today
is from a given DateTime
due date. If DateTime.Today
is past due date, the Form.Opacity
is set to 0 and the Form.Controls
is cleared.
- Add the
WinformsNotPaid.dll
to your project References. - Import the class library in your Form
.cs
using WinformsNotPaid;
- Inside the Form constructor, after
InitializeComponent()
, call theChangeNotPaidOpacity
method:
public Form1()
{
InitializeComponent();
this.ChangeNotPaidOpacity(DateTime.Parse("Aug 25, 2019"), 30);
}
(couldn't think of a better name) It takes two parameters:
- dueDate: A
System.DateTime
that marks the last day before the Opacity is set to 0 and all the controls are removed. - daysDeadline: A integer that says how many days before the dueDate should the Opacity start to lower.