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;

}

}

}

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

相关推荐
Blossom.1188 分钟前
使用Python实现简单的人工智能聊天机器人
开发语言·人工智能·python·低代码·数据挖掘·机器人·云计算
da-peng-song16 分钟前
ArcGIS Desktop使用入门(二)常用工具条——数据框工具(旋转视图)
开发语言·javascript·arcgis
galaxy_strive16 分钟前
qtc++ qdebug日志生成
开发语言·c++·qt
TNTLWT19 分钟前
Qt功能区:简介与安装
开发语言·qt
CoderIsArt32 分钟前
参数系统的基类Parameter抽象类
c#
等等5431 小时前
Java EE初阶——wait 和 notify
java·开发语言
低代码布道师2 小时前
第五部分:第一节 - Node.js 简介与环境:让 JavaScript 走进厨房
开发语言·javascript·node.js
盛夏绽放2 小时前
Python字符串常用方法详解
开发语言·python·c#
好吃的肘子3 小时前
Elasticsearch架构原理
开发语言·算法·elasticsearch·架构·jenkins
nlog3n3 小时前
Go语言交替打印问题及多种实现方法
开发语言·算法·golang