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;

}

}

}

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

相关推荐
民乐团扒谱机4 分钟前
【微科普】GN 算法:在网络的脉络中,寻找社群的边界
开发语言·算法·matlab·语言学·语义网络分析
yaoxin52112312 分钟前
263. Java 集合 - 遍历 List 时选用哪种方式?ArrayList vs LinkedList
java·开发语言·list
骇客野人14 分钟前
java对象和JSON对象之间的转换关系
java·开发语言·json
lubiii_24 分钟前
Aircrack-ng工具使用原理与实操笔记
开发语言·网络·web安全·php
她说彩礼65万26 分钟前
C# ConcurrentDictionary详解
java·服务器·c#
DataIntel26 分钟前
WPF 中的数据模板(DataTemplate)与样式/控件模板(Style / ControlTemplate)详解
c#
weixin_3077791327 分钟前
Jenkins Metrics 插件全解析:从数据采集到智能监控的实践指南
运维·开发语言·架构·jenkins
阿拉伯柠檬28 分钟前
实现一个异步操作线程池
开发语言·数据结构·c++·面试
半瓶榴莲奶^_^31 分钟前
后端Web进阶(AOP)
java·开发语言
raoxiaoya33 分钟前
ADK-Go:Golang开发AI Agent
开发语言·人工智能·golang