46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
|
|
///
|
||
|
|
/// Copyright (c) 2017 Sensus Metering Systems
|
||
|
|
///
|
||
|
|
using System;
|
||
|
|
using System.Drawing;
|
||
|
|
using System.Windows.Forms;
|
||
|
|
using TBF.Resources;
|
||
|
|
|
||
|
|
namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||
|
|
{
|
||
|
|
public class CheckBoxImage : PictureBox
|
||
|
|
{
|
||
|
|
private bool cchecked;
|
||
|
|
private readonly Image ci;
|
||
|
|
private readonly Image uci;
|
||
|
|
|
||
|
|
public CheckBoxImage()
|
||
|
|
: this(new Bitmap(TBF.Properties.Resources.SwitchOn), new Bitmap(TBF.Properties.Resources.SwitchOff), true)
|
||
|
|
{
|
||
|
|
SizeMode = PictureBoxSizeMode.StretchImage;
|
||
|
|
}
|
||
|
|
|
||
|
|
public CheckBoxImage(Image checkedimage, Image uncheckedimage, bool initState)
|
||
|
|
: base()
|
||
|
|
{
|
||
|
|
ci = checkedimage;
|
||
|
|
uci = uncheckedimage;
|
||
|
|
Click += (sender, e) => { Checked = !Checked; };
|
||
|
|
Checked = initState;
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Checked
|
||
|
|
{
|
||
|
|
get { return cchecked; }
|
||
|
|
set
|
||
|
|
{
|
||
|
|
if (Enabled)
|
||
|
|
{
|
||
|
|
Image = value ? ci : uci;
|
||
|
|
cchecked = value;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|