diff --git a/TBF/BenchControl/DataEntry/DataStream/CheckBoxImage.cs b/TBF/BenchControl/DataEntry/DataStream/CheckBoxImage.cs new file mode 100644 index 000000000..5c6cbefa1 --- /dev/null +++ b/TBF/BenchControl/DataEntry/DataStream/CheckBoxImage.cs @@ -0,0 +1,45 @@ +/// +/// Copyright (c) 2021 Sensus Slovensko a.s. +/// +using System; +using System.Drawing; +using System.Windows.Forms; +using TBF.Resources; + +namespace TBF.BenchControl.DataEntry.DataStream +{ + public class CheckBoxImage : PictureBox + { + private bool cbChecked; + private readonly Image checkedImg; + private readonly Image uncheckedImg; + + public CheckBoxImage() + : this(new Bitmap(TBF.Properties.Resources.SwitchOn), new Bitmap(TBF.Properties.Resources.SwitchOff), true) + { + SizeMode = PictureBoxSizeMode.StretchImage; + } + + public CheckBoxImage(Image checkedImg, Image uncheckedImg, bool initState) + : base() + { + this.checkedImg = checkedImg; + this.uncheckedImg = uncheckedImg; + Click += (sender, e) => { Checked = !Checked; }; + Checked = initState; + } + + public bool Checked + { + get { return cbChecked; } + set + { + if (Enabled) + { + Image = value ? checkedImg : uncheckedImg; + cbChecked = value; + } + } + } + } +} diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index 798fc21a1..47b24f1ce 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -215,11 +215,18 @@ TestStartEndForm.cs - + + Component + + + Form + CycleBeginningForm.cs - + + Form + CycleEndForm.cs @@ -227,7 +234,9 @@ - + + Form + TestStartEndForm.cs