///// <summary> ///// Occurs when subproperty value has changed. ///// </summary> //public event DevComponents.Schedule.Model.SubPropertyChangedEventHandler SubPropertyChanged; /// <summary> /// Initializes a new instance of the ClockControl class /// </summary> public AnalogClockControl() { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true); _AntiAlias = true; _AutomaticMode = false; _ClockStyle = eClockStyles.Style1; _ClockStyleData = new ClockStyleData(); _ClockStyleData.Parent = this; _EditState = eClockEditStates.None; _IndicatorStyle = eClockIndicatorStyles.Ticks; _IsEditable = false; _ShowGlassOverlay = true; _ShowSecondHand = true; _Value = DateTime.Now; MinimumSize = new Size((int)_BaseSize, (int)_BaseSize); ; Size = MinimumSize; }
/// <summary> /// Initializes a new instance of the ClockStyle class. /// </summary> /// <param name="style">Predefined style from the PredefinedStyles enum.</param> public ClockStyleData(eClockStyles style, AnalogClockControl parent) { LoadStyle(style); _Parent = parent; }
/// <summary> /// Loads a predefined style /// </summary> /// <param name="style">The predefined style to load.</param> private void LoadStyle(eClockStyles style) { _Style = style; switch (style) { case eClockStyles.Style1: case eClockStyles.Custom: _ClockShape = eClockShapes.Round; BezelColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(255, 255, 255), Color.FromArgb(152, 152, 152), Color.FromArgb(120, 120, 120), 0.01f); _BezelWidth = 0.03f; FaceColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(191, 204, 213), Color.FromArgb(255, 255, 255), Color.FromArgb(135, 145, 161), 0.01f, 45.0f); _FaceBackgroundImage = null; HourHandStyle = new ClockHandStyleData(eHandStyles.Style1, 0.55f, 0.015f); MinuteHandStyle = new ClockHandStyleData(eHandStyles.Style1, 0.8f, 0.01f); SecondHandStyle = new ClockHandStyleData(eHandStyles.Style2, 0.8f, 0.005f); CapColor = new ColorData(eBrushTypes.Solid, Color.FromArgb(109, 127, 138), Color.FromArgb(109, 127, 138), Color.FromArgb(128, 109, 127, 138), 0.01f); _CapSize = 0.03f; _NumberColor = Color.FromArgb(139, 158, 168); _NumberFont = new Font("Microsoft Sans Serif", 12, FontStyle.Regular, GraphicsUnit.Pixel); LargeTickColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(122, 142, 154), Color.FromArgb(122, 142, 154), Color.FromArgb(128, 255, 255, 255), 0.01f); _LargeTickLength = 0.06f; _LargeTickWidth = 0.02f; SmallTickColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(122, 142, 154), Color.FromArgb(122, 142, 154), Color.FromArgb(128, 255, 255, 255), 0.01f); _SmallTickLength = 0.02f; _SmallTickWidth = 0.02f; _GlassAngle = -20; break; case eClockStyles.Style2: _ClockShape = eClockShapes.Round; BezelColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(80, 80, 80), Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 0), 0.0f, 90.0f); _BezelWidth = 0.03f; FaceColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(225, 225, 225), Color.FromArgb(240, 240, 240), Color.FromArgb(0, 0, 0), 0.0f, 90.0f); _FaceBackgroundImage = null; HourHandStyle = new ClockHandStyleData(eHandStyles.Style3, 0.45f, 0.175f); HourHandStyle.HandColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(0, 0, 0), Color.FromArgb(80, 80, 80), Color.FromArgb(64, 0, 0, 0), 0.01f, 90.0f); MinuteHandStyle = new ClockHandStyleData(eHandStyles.Style3, 0.75f, 0.175f); MinuteHandStyle.HandColor = new ColorData(eBrushTypes.Linear, Color.FromArgb(0, 0, 0), Color.FromArgb(80, 80, 80), Color.FromArgb(64, 0, 0, 0), 0.01f, 90.0f); SecondHandStyle = new ClockHandStyleData(eHandStyles.Style4, 0.9f, 0.01f); SecondHandStyle.HandColor = new ColorData(eBrushTypes.Solid, Color.FromArgb(255, 0, 0), Color.FromArgb(255, 0, 0), Color.FromArgb(128, 192, 0, 0), 0.01f); _SecondHandStyle.DrawOverCap = true; CapColor = new ColorData(eBrushTypes.Solid, Color.FromArgb(255, 255, 255), Color.FromArgb(255, 255, 255), Color.FromArgb(223, 0, 0, 0), 0.01f); _CapSize = 0.1f; _NumberColor = Color.FromArgb(0, 0, 0); _NumberFont = new Font("Trebuchet MS", 12, FontStyle.Regular, GraphicsUnit.Pixel); LargeTickColor = new ColorData(eBrushTypes.Solid, Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 0), Color.FromArgb(64, 0, 0, 0), 0.01f); _LargeTickLength = 0.06f; _LargeTickWidth = 0.01f; SmallTickColor = new ColorData(eBrushTypes.Solid, Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 0), Color.FromArgb(64, 0, 0, 0), 0.01f); _SmallTickLength = 0.01f; _SmallTickWidth = 0.01f; _GlassAngle = 0; break; } }
/// <summary> /// Initializes a new instance of the ClockStyle class. /// </summary> /// <param name="style">Predefined style from the PredefinedStyles enum.</param> public ClockStyleData(eClockStyles style) { LoadStyle(style); }