DataEntry.DataStream.CheckBoxImage added.

This commit is contained in:
Milan Hanajik 2021-07-15 11:00:14 +02:00
parent e46b64bd29
commit 2e8c5fa6f6
2 changed files with 57 additions and 3 deletions

View File

@ -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;
}
}
}
}
}

View File

@ -215,11 +215,18 @@
<Compile Include="BenchControl\DataEntry\Combined\TestStartEndForm.designer.cs">
<DependentUpon>TestStartEndForm.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\DataEntry\DataStream\CycleBeginningForm.cs" />
<Compile Include="BenchControl\DataEntry\DataStream\CheckBoxImage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="BenchControl\DataEntry\DataStream\CycleBeginningForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BenchControl\DataEntry\DataStream\CycleBeginningForm.designer.cs">
<DependentUpon>CycleBeginningForm.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\DataEntry\DataStream\CycleEndForm.cs" />
<Compile Include="BenchControl\DataEntry\DataStream\CycleEndForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BenchControl\DataEntry\DataStream\CycleEndForm.designer.cs">
<DependentUpon>CycleEndForm.cs</DependentUpon>
</Compile>
@ -227,7 +234,9 @@
<Compile Include="BenchControl\DataEntry\DataStream\EntryFormCfg.cs" />
<Compile Include="BenchControl\DataEntry\DataStream\Factory.cs" />
<Compile Include="BenchControl\DataEntry\DataStream\OpenConnCompletedEventArgs.cs" />
<Compile Include="BenchControl\DataEntry\DataStream\TestStartEndForm.cs" />
<Compile Include="BenchControl\DataEntry\DataStream\TestStartEndForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BenchControl\DataEntry\DataStream\TestStartEndForm.designer.cs">
<DependentUpon>TestStartEndForm.cs</DependentUpon>
</Compile>