请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册
查看: 6740|回复: 4

实现Ctrl+S保存

[复制链接]

84

主题

115

帖子

731

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
1467
发表于 2020-1-1 22:35:48 | 显示全部楼层 |阅读模式
实现Ctrl+S保存:
(1)点击Form窗口(2)查看属性:设置KeyPreview为true
(3)点击鼠标响应:找到KeyDown,双击进入,即可写程序:
  1.             if (e.Control && MouseButtons == MouseButtons.Left)
  2.             {

  3.             }
  4.             else if (e.Control && MouseButtons == MouseButtons.Middle)
  5.             {

  6.             }
  7.             else if (e.Control == true && e.KeyCode == Keys.S)
  8.             {
  9.                 // 保存Label图像
  10.                 try
  11.                 {
  12.                     xmlFile.readXml("AITrainConfigs.xml", ref AITrainConfigsParams);
  13.                     string TrainImageSavePath = AITrainConfigsParams["ImagePath"];
  14.                     if (!Directory.Exists(TrainImageSavePath))
  15.                     {
  16.                         Directory.CreateDirectory(TrainImageSavePath);  // 创建TrainImageSavePath路径
  17.                         Directory.CreateDirectory(TrainImageSavePath + @"/" + "Image");  // 创建TrainImageSavePath路径
  18.                         Directory.CreateDirectory(TrainImageSavePath + @"/" + "Mask");   // 创建TrainImageSavePath路径
  19.                         Directory.CreateDirectory(TrainImageSavePath + @"/" + "Temp");   // 创建TrainImageSavePath路径
  20.                     }
  21.                     AIImagePath = TrainImageSavePath + @"/" + "Temp";
  22.                     HOperatorSet.WriteImage(ho_ImageMask, "png", 0, AIImagePath + @"/" + ImageNameWithoutFormat + ".png");
  23.                 }
  24.                 catch { }
  25.             }
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-3-29 16:20 , Processed in 0.251848 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表