CheckButton:
ImageList imgList;
private void Form1_Load(object sender, EventArgs e)
{
imgList = new ImageList();
//项目路径
string path=System.Windows.Forms.Application.StartupPath;
Image img1 = new Bitmap(path + "\\image\\TV Off.png");
Image img2 = new Bitmap(path + "\\image\\TV On.png");
imgList.Images.Add(img1);
imgList.Images.Add(img2);
checkButton1.Image=imgList.Images[0];
//注册事件
checkButton1.CheckedChanged+=new EventHandler(checkButton1_CheckedChanged);
}
private void checkButton1_CheckedChanged(object sender, EventArgs e)
{
if (checkButton1.Checked)
{
checkButton1.Image = imgList.Images[1];
}
else {
checkButton1.Image = imgList.Images[0];
}
checkButton1.BackgroundImageLayout = ImageLayout.Stretch;
}
CalcEdit: //小数位数(精确度)
calcEdit1.Properties.Precision = 2;
//显示关闭按钮
calcEdit1.Properties.ShowCloseButton = false;
//在下拉框中(单击、双击、从不)会 显示下拉框
calcEdit1.Properties.ShowDropDown = DevExpress.XtraEditors.Controls.ShowDropDown.DoubleClick;