C#:通用方法总结—第11集

大家好,今天继续分享我们的通用方法系列。

下面是今天要分享的通用方法:

(1)这个通用方法为Ug'校验选中体的个数:

/// <summary>

/// 输出选中体个数

/// </summary>

public int CheckOneBody()

{

int selcount = 0;

theUFSession.Ui.AskGlobalSelObjectList(out selcount, out objs);

if (selcount < 1)

{

theUI.NXMessageBox.Show("提示", NXMessageBox.DialogType.Information, "一个体都没有被选中");

return selcount;

}

else if (selcount > 1)

{

theUI.NXMessageBox.Show("提示", NXMessageBox.DialogType.Information, "选中了"+ selcount +"个体");

ok_cb();

return selcount;

}

return selcount;

}

(2)这个通用方法为判断是公制还是英制:

/// <summary>

/// 判断是公制还是英制

/// </summary>

public void GetPartUnit()

{

int returnvalue = 0;

theUFSession.Part.AskUnits(workPart.Tag, out returnvalue);

if(returnvalue!=1)

{

ism = false;

}

}

(3)这个通用方法为datagridview判断是否选中单元格:

/// <summary>

/// datagridview判断是否选中单元格

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)

{

int rows=0

if (e.RowIndex != -1 && e.ColumnIndex != -1)

{

if (dataGridView2.CurrentCell != null)

{

Rows=1;

}

}

}

今天要分享的通用方法就是这么多,我们下篇文章再见。

相关推荐
用户298698530143 小时前
.NET 文档自动化:Spire.Doc 设置奇偶页页眉/页脚的最佳实践
后端·c#·.net
用户3667462526743 小时前
接口文档汇总 - 2.设备状态管理
c#
用户3667462526743 小时前
接口文档汇总 - 3.PLC通信管理
c#
Ray Liang1 天前
用六边形架构与整洁架构对比是伪命题?
java·python·c#·架构设计
Scout-leaf4 天前
WPF新手村教程(三)—— 路由事件
c#·wpf
用户298698530144 天前
程序员效率工具:Spire.Doc如何助你一键搞定Word表格排版
后端·c#·.net
mudtools5 天前
搭建一套.net下能落地的飞书考勤系统
后端·c#·.net
玩泥巴的6 天前
搭建一套.net下能落地的飞书考勤系统
c#·.net·二次开发·飞书
唐宋元明清21886 天前
.NET 本地Db数据库-技术方案选型
windows·c#
郑州光合科技余经理6 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php