Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#region Using
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Runtime.InteropServices;
#endregion
namespace SludgeSchedulerControls.Widgets
{
class ExtendedDateTimePicker : System.Windows.Forms.DateTimePicker
{
private System.Drawing.Color _backColorDisabled = System.Drawing.Color.Gainsboro;// System.Drawing.Color.Gainsboro;
private System.Drawing.Color _foreColorDisabled = System.Drawing.SystemColors.ControlText;
protected override void OnEnabledChanged( EventArgs e)
{
base.OnEnabledChanged( e );
if (!(this.Enabled))
{
this.SetStyle(System.Windows.Forms.ControlStyles.UserPaint, true);
}
else
{
this.SetStyle(System.Windows.Forms.ControlStyles.UserPaint, false);
}
this.Invalidate();
}
protected override void OnPaint( System.Windows.Forms.PaintEventArgs e )
{
base.OnPaint( e );
System.Drawing.SolidBrush textBrush;
//Set user selected backcolor when disabled
if (this.Enabled)
{
textBrush = new System.Drawing.SolidBrush( this.ForeColor );
}
else
{
System.Drawing.Color backColorDisabled = this._backColorDisabled;
if (this.Parent.FindForm() != null)
{
backColorDisabled = this.Parent.FindForm().BackColor;
}
textBrush = new System.Drawing.SolidBrush( this._foreColorDisabled );
System.Drawing.SolidBrush backBrush = new System.Drawing.SolidBrush( backColorDisabled );
e.Graphics.FillRectangle( backBrush, ClientRectangle );
}
//Paint text
e.Graphics.DrawString( this.Text, this.Font, textBrush, 1.0F, 1.0F );
}
}
}