|
实现Ctrl+S保存:
(1)点击Form窗口(2)查看属性:设置KeyPreview为true
(3)点击鼠标响应:找到KeyDown,双击进入,即可写程序:
- if (e.Control && MouseButtons == MouseButtons.Left)
- {
- }
- else if (e.Control && MouseButtons == MouseButtons.Middle)
- {
- }
- else if (e.Control == true && e.KeyCode == Keys.S)
- {
- // 保存Label图像
- try
- {
- xmlFile.readXml("AITrainConfigs.xml", ref AITrainConfigsParams);
- string TrainImageSavePath = AITrainConfigsParams["ImagePath"];
- if (!Directory.Exists(TrainImageSavePath))
- {
- Directory.CreateDirectory(TrainImageSavePath); // 创建TrainImageSavePath路径
- Directory.CreateDirectory(TrainImageSavePath + @"/" + "Image"); // 创建TrainImageSavePath路径
- Directory.CreateDirectory(TrainImageSavePath + @"/" + "Mask"); // 创建TrainImageSavePath路径
- Directory.CreateDirectory(TrainImageSavePath + @"/" + "Temp"); // 创建TrainImageSavePath路径
- }
- AIImagePath = TrainImageSavePath + @"/" + "Temp";
- HOperatorSet.WriteImage(ho_ImageMask, "png", 0, AIImagePath + @"/" + ImageNameWithoutFormat + ".png");
- }
- catch { }
- }
复制代码
|
|