Files
DHDHSoftware/DHSoftware/Views/DetectControl.cs
2025-04-30 16:13:13 +08:00

798 lines
32 KiB
C#

using System.ComponentModel;
using System.Data;
using System.Reflection;
using AntdUI;
using DH.Commons.Base;
using DH.Commons.Enums;
using DH.Devices.PLC;
using XKRS.CanFly;
using static System.Windows.Forms.AxHost;
using static DH.Commons.Enums.EnumHelper;
namespace DHSoftware.Views
{
public partial class DetectControl : UserControl
{
Window window;
DetectionConfig detectionConfig;
public DetectControl(Window _window, DetectionConfig _detection)
{
window = _window;
detectionConfig = _detection;
InitializeComponent();
//this.detectionConfig = detectionConfig;
//初始化表格列头
InitTableColumns();
foreach (var item in MLModelTypes)
{
stDetectType.Items.Add(item.Key);
}
BindEventHandler();
// 如果你的控件是通过设计器生成的,确保事件已经在设计器文件中绑定。
swtPre.CheckedChanged += swtPre_CheckedChanged; // 确保控件的事件处理器被注册
swIsAddStation.CheckedChanged += swIsAddStation_CheckedChanged; // 确保控件的事件处理器被注册
swIsEnabled.CheckedChanged += swIsEnabled_CheckedChanged; // 确保控件的事件处理器被注册
stDetectType.SelectedIndexChanged += stDetectType_SelectedIndexChanged; // 确保控件的事件处理器被注册
iptScore.TextChanged += IptScore_TextChanged;
iptModelPath.TextChanged += IptModelPath_TextChanged;
}
private void IptScore_TextChanged(object sender, EventArgs e)
{
if (_config != null && !string.IsNullOrEmpty(iptScore.Text))
{
if (float.TryParse(iptScore.Text, out float score) && _config.ModelconfThreshold != score)
{
_config.ModelconfThreshold = score;
}
else
{
iptScore.Text = _config.ModelconfThreshold.ToString();
}
}
}
private void IptModelPath_TextChanged(object sender, EventArgs e)
{
if (_config != null && !string.IsNullOrEmpty(iptModelPath.Text))
{
if ( _config.ModelPath != iptModelPath.Text)
{
_config.ModelPath = iptModelPath.Text;
}
else
{
iptModelPath.Text = _config.ModelPath;
}
}
}
private void stDetectType_SelectedIndexChanged(object sender, EventArgs e)
{
// 下拉选项变更事件处理
if (_config != null && stDetectType.SelectedIndex != -1)
{
// 防止循环更新
if ((int)_config.ModelType != stDetectType.SelectedIndex + 1)
{
_config.ModelType = (MLModelType)(stDetectType.SelectedIndex + 1);
}
}
}
private void swtPre_CheckedChanged(object sender, EventArgs e)
{
// 当用户改变控件的值时,更新数据模型的属性
if (_config != null)
{
_config.IsPreEnabled = swtPre.Checked;
}
}
private void swIsAddStation_CheckedChanged(object sender, EventArgs e)
{
// 当用户改变控件的值时,更新数据模型的属性
if (_config != null)
{
_config.IsAddStation = swIsAddStation.Checked;
}
}
private void swIsEnabled_CheckedChanged(object sender, EventArgs e)
{
// 当用户改变控件的值时,更新数据模型的属性
if (_config != null)
{
_config.IsEnabled = swIsEnabled.Checked;
}
}
/// <summary>
/// 更新尺寸测量表格
/// </summary>
private void UpdatePreTreatCollectsFromSizeTable()
{
// 假设 SizeLableList 是 SizeTable 的数据源
List<SizeTreatParam> updatedPreTreatCollects = new List<SizeTreatParam>();
foreach (var sizeTreat in SizeLableList)
{
var preTreatCollect = new SizeTreatParam
{
IsEnable = sizeTreat.IsEnable,
PreName = sizeTreat.PreName,
PrePix = sizeTreat.PrePix,
PreType = sizeTreat.PreType,
ResultShow = sizeTreat.ResultShow,
OutResultShow = sizeTreat.OutResultShow
};
updatedPreTreatCollects.Add(preTreatCollect);
}
// 将更新后的数据设置到 PreTreatCollects
detectionConfig.PreTreatCollects = updatedPreTreatCollects;
}
private void BindEventHandler()
{
//预处理
btnPrePath.Click += btnPath_Click;
btnPreAdd.Click += BtnPreAdd_Click; ;
btnPreDelete.Click += BtnPreDelete_Click; ;
preTable.CellClick += PreTable_CellClick; ;
preTable.CellButtonClick += PreTable_CellButtonClick;
btnOutAdd.Click += BtnOutAdd_Click; ;
btnOutDelete.Click += BtnOutDelete_Click; ;
PreOutTable.CellButtonClick += PreOutTable_CellButtonClick; ;
//中处理
btnPath2.Click += BtnPath2_Click;
btnCorrelatedCamera.Click += BtnCorrelatedCamera_Click;
btnPic.Click += BtnPic_Click;
btnLableAdd.Click += BtnLableAdd_Click;
btnLableDelete.Click += BtnLableDelete_Click;
lableTable.CellButtonClick += LableTable_CellButtonClick;
btnSizeAdd.Click += BtnSizeAdd_Click;
btnSizeDel.Click += BtnSizeDelete_Click;
SizeTable.CellButtonClick += SizeTable_CellButtonClick;
}
private void LableTable_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is DetectionLable DetectionLable)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new DetectionLableEdit(window, DetectionLable) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
detectionConfig.DetectionLableList.Remove(DetectionLable);
break;
}
}
}
private void SizeTable_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is SizeTreatParam sizeTreat)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new SizeLabelEdit(window, sizeTreat) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
UpdatePreTreatCollectsFromSizeTable();
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
detectionConfig.SizeTreatParamList.Remove(sizeTreat);
break;
case "进行测量":
var sizeType = ((int)sizeTreat.PreType).ToString();
// 根据测量类型打开不同的窗口
switch (sizeType)
{
case "1":
case "2":
case "3":
case "4":
case "5":
FrmMain3 frmMain3 = new FrmMain3(sizeType);
frmMain3.ShowDialog();
if (!string.IsNullOrEmpty(frmMain3.inputtext))
{
sizeTreat.ResultShow = frmMain3.inputtext;
}
if (!string.IsNullOrEmpty(frmMain3.outtext))
{
sizeTreat.OutResultShow = frmMain3.outtext;
}
break;
default:
MessageBox.Show("未定义的测量类型!");
break;
}
UpdatePreTreatCollectsFromSizeTable();
//使用clone可以防止table中的image被修改
//Preview.open(new Preview.Config(window, (Image)SizeParamLable.CellImages[0].Image.Clone()));
break;
}
}
}
private void BtnLableDelete_Click(object? sender, EventArgs e)
{
if (detectionConfig.DetectionLableList.Count == 0 || !detectionConfig.DetectionLableList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = detectionConfig.DetectionLableList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (detectionConfig.DetectionLableList[i].Selected)
{
detectionConfig.DetectionLableList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnLableAdd_Click(object? sender, EventArgs e)
{
DetectionLable detectionLable = new DetectionLable()
{
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
}
};
var form = new DetectionLableEdit(window, detectionLable) { Size = new Size(450, 500) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
detectionConfig.DetectionLableList.Add(detectionLable);
}
}
private void BtnSizeDelete_Click(object? sender, EventArgs e)
{
if (detectionConfig.SizeTreatParamList.Count == 0 || !detectionConfig.SizeTreatParamList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = detectionConfig.SizeTreatParamList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (detectionConfig.SizeTreatParamList[i].Selected)
{
detectionConfig.SizeTreatParamList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnSizeAdd_Click(object? sender, EventArgs e)
{
SizeTreatParam SizeParamLable = new SizeTreatParam()
{
//CellBadge = new CellBadge(SizeEnum.Circle.GetEnumDescription()),
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
}
};
var form = new SizeLabelEdit(window, SizeParamLable) { Size = new Size(450, 500) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
detectionConfig.SizeTreatParamList.Add(SizeParamLable);
}
}
private void BtnPic_Click(object? sender, EventArgs e)
{
}
private void BtnCorrelatedCamera_Click(object? sender, EventArgs e)
{
var form = new CorrelatedCameraEdit(window, detectionConfig.CameraCollects) { Size = new Size(500, 400) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
flowCameraPanel.Controls.Clear();
if (detectionConfig.CameraCollects.Count > 0)
{
foreach (var item in detectionConfig.CameraCollects)
{
var control = new AntdUI.Tag()
{
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
Size = new Size(90, 42),
Text = item.CameraSourceId,
CloseIcon = true
};
control.CloseChanged += (sender, e) =>
{
var tag = sender as Tag;
foreach (var item in detectionConfig.CameraCollects)
{
if (item.CameraSourceId.Equals(tag.Text))
{
detectionConfig.CameraCollects.Remove(item);
break;
}
}
return true;
};
// 通过主窗口设置DPI控制添加控件保持缩放比例
window.AutoDpi(control);
flowCameraPanel.Controls.Add(control);
control.BringToFront();
}
}
}
}
private bool Control_CloseChanged(object sender, EventArgs e)
{
throw new NotImplementedException();
}
private void BtnPath2_Click(object? sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
// 设置对话框标题
openFileDialog.Title = "选择中处理文件";
// 限制文件后缀为 .onnx、trt
openFileDialog.Filter = "中处理文件 (*.onnx, *.trt)|*.onnx;*.trt";
// 禁止多选
openFileDialog.Multiselect = false;
// 显示对话框并等待用户操作
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string filePath = openFileDialog.FileName;
iptDetectPath.Text = filePath;
}
}
}
private void PreOutTable_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PreTreatParam PreTreat)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new PreTreatEdit(window, PreTreat) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
detectionConfig.OUTPreTreatParams.Remove(PreTreat);
break;
}
}
}
private void BtnOutDelete_Click(object? sender, EventArgs e)
{
if (detectionConfig.OUTPreTreatParams.Count == 0 || !detectionConfig.OUTPreTreatParams.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = detectionConfig.OUTPreTreatParams.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (detectionConfig.OUTPreTreatParams[i].Selected)
{
detectionConfig.OUTPreTreatParams.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnOutAdd_Click(object? sender, EventArgs e)
{
PreTreatParam preParam = new PreTreatParam()
{
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
}
};
var form = new PreTreatEdit(window, preParam) { Size = new Size(400, 300) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
detectionConfig.OUTPreTreatParams.Add(preParam);
}
}
private void PreTable_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PreTreatParam PreTreat)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new PreTreatEdit(window, PreTreat) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
detectionConfig.PreTreatParams.Remove(PreTreat);
break;
}
}
}
private void PreTable_CellClick(object sender, TableClickEventArgs e)
{
}
private void BtnPreDelete_Click(object? sender, EventArgs e)
{
if (detectionConfig.PreTreatParams.Count == 0 || !detectionConfig.PreTreatParams.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = detectionConfig.PreTreatParams.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (detectionConfig.PreTreatParams[i].Selected)
{
detectionConfig.PreTreatParams.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnPreAdd_Click(object? sender, EventArgs e)
{
PreTreatParam preParam = new PreTreatParam()
{
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
}
};
var form = new PreTreatEdit(window, preParam) { Size = new Size(400, 300) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
detectionConfig.PreTreatParams.Add(preParam);
}
}
//加载相机
private void InitRelatedCamera()
{
if (relatedCameras.Count > 0)
{
foreach (var item in relatedCameras)
{
var control = new AntdUI.Tag()
{
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
Size = new Size(90, 42),
Text = item.CameraSourceId,
CloseIcon = true
};
control.CloseChanged += (sender, e) =>
{
var tag = sender as Tag;
foreach (var item in relatedCameras)
{
if (item.CameraSourceId.Equals(tag.Text))
{
relatedCameras.Remove(item);
break;
}
}
detectionConfig.CameraCollects = relatedCameras;
return true;
};
// 通过主窗口设置DPI控制添加控件保持缩放比例
window.AutoDpi(control);
flowPanel1.Controls.Add(control);
control.BringToFront();
}
}
}
private void InitData()
{
stDetectType.Items.Clear();
foreach (ModelType value in Enum.GetValues(typeof(ModelType)))
{
stDetectType.Items.Add(value.ToString());
}
preTable.Binding(detectionConfig.PreTreatParams);
PreOutTable.Binding(detectionConfig.OUTPreTreatParams);
lableTable.Binding(detectionConfig.DetectionLableList);
SizeTable.Binding(detectionConfig.SizeTreatParamList);
if (detectionConfig.PreTreatParams.Count > 0)
{
foreach (var item in detectionConfig.PreTreatParams)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
if (detectionConfig.OUTPreTreatParams.Count > 0)
{
foreach (var item in detectionConfig.OUTPreTreatParams)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
if (detectionConfig.DetectionLableList.Count > 0)
{
foreach (var item in detectionConfig.DetectionLableList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
if (detectionConfig.SizeTreatParamList.Count > 0)
{
foreach (var item in detectionConfig.SizeTreatParamList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error),
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
};
}
}
if (detectionConfig.CameraCollects.Count > 0)
{
foreach (var item in detectionConfig.CameraCollects)
{
var control = new AntdUI.Tag()
{
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
Size = new Size(90, 42),
Text = item.CameraSourceId,
CloseIcon = true
};
window.AutoDpi(control);
flowCameraPanel.Controls.Add(control);
control.BringToFront();
}
}
//1
sthPreStatus.DataBindings.Add("Checked", detectionConfig, "IsPreEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
iptPrePath.DataBindings.Add("Text", detectionConfig, "HalconAlgorithemPath_Pre", true, DataSourceUpdateMode.OnPropertyChanged);
//2
sthDetectStatus.DataBindings.Add("Checked", detectionConfig, "IsEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
sthStation.DataBindings.Add("Checked", detectionConfig, "IsAddStation", true, DataSourceUpdateMode.OnPropertyChanged);
stDetectType.DataBindings.Add("Text", detectionConfig, "ModelType", true, DataSourceUpdateMode.OnPropertyChanged);
iptConfidence.DataBindings.Add("Text", detectionConfig, "ModelconfThreshold", true, DataSourceUpdateMode.OnPropertyChanged);
iptDetectPath.DataBindings.Add("Text", detectionConfig, "ModelPath", true, DataSourceUpdateMode.OnPropertyChanged);
sthOKOriginal.DataBindings.Add("Checked", detectionConfig, "SaveOKOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
sthNGOriginal.DataBindings.Add("Checked", detectionConfig, "SaveNGOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
sthOKDetect.DataBindings.Add("Checked", detectionConfig, "SaveOKDetect", true, DataSourceUpdateMode.OnPropertyChanged);
sthDetectNG.DataBindings.Add("Checked", detectionConfig, "SaveNGDetect", true, DataSourceUpdateMode.OnPropertyChanged);
}
private void InitTableColumns()
{
preTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("Name", "名称", ColumnAlign.Center),
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
PreOutTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("Name", "名称", ColumnAlign.Center),
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
lableTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("LabelName", "名称", ColumnAlign.Center),
new Column("MinScore", "最小得分",ColumnAlign.Center),
new Column("MaxScore", "最大得分", ColumnAlign.Center),
new Column("MinArea", "最小面积",ColumnAlign.Center),
new Column("MaxArea", "最大面积", ColumnAlign.Center),
new Column("ResultState", "结果", ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
SizeTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new ColumnSwitch("IsEnable", "是否启用") {Width = "10%" },
new Column("PreName", "测量名称") { Width = "15%" },
new Column("PreType", "测量类型") { Width = "10%" },
new Column("PrePix", "阈值") { Width = "5%" },
new Column("ResultShow", "输入参数") { Width = "15%" },
new Column("OutResultShow", "输出参数") { Width = "15%" },
new Column("CellLinks", "操作") { Width = "30%" }
};
}
private void btnPath_Click(object? sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
// 设置对话框标题
openFileDialog.Title = "选择预处理文件";
// 限制文件后缀为 .hdvp
openFileDialog.Filter = "中处理 (*.hdvp)|*.hdvp";
// 禁止多选
openFileDialog.Multiselect = false;
// 显示对话框并等待用户操作
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string filePath = openFileDialog.FileName;
iptPrePath.Text = filePath;
}
}
}
}
}