- 博客(37)
- 收藏
- 关注
原创 操作注册表
注册表注册 public static void SaveReg(string p_Filename, string p_FileTypeName) { RegistryKey _RegKey = Registry.ClassesRoot.OpenSubKey("", true); //打开注册表 RegistryKey _VRPkey = _RegKey.OpenSubKey(p_FileTy.
2021-08-20 10:06:37
144
原创 软考--高项
快速复习:https://me.51cto.com/p/218.html2017年信息系统项目管理师考试题型分析(2017上半年):http://www.cnitpm.com/pm1/43634.html高项是什么?PMP®和高项哪个更好考?:https://www.educity.cn/pmp/2049993.html高项管理工程选择题:http://www.doc88.com/p-2505581459322.html http://www.doc88.com/p-14560828691...
2021-04-09 15:41:58
432
原创 C# ListView失去焦点仍然保持选中的Item高亮
private void listView_Validated( object sender, EventArgs e){ if (listView.FocusedItem != null ) { listView.FocusedItem.BackColor = SystemColors.Highlight; listView.FocusedItem.ForeColor = Color.White; }}priv.
2021-03-25 11:39:49
1789
原创 深拷贝与浅拷贝
浅拷贝:引用成员在被拷贝时仅复制源对象中引用成员的地址到新对象中,所以在新对象中对引用成员进行更改会影响到源对象(除对引用成员进行赋值外)。深拷贝:引用成员在拷贝时新建一个引用对象到新对象中,且将源对象中引用对象的成员值复制到新对象的引用对象中,所以在新对象中对引用成员进行更改不会影响源对象。说起来概念也简单,我想大家纠结的是如何实现深拷贝?浅拷贝的实现很简单,调用Object.MemberwiseClone就万事大吉了。在网上找了一个通过序列化实现深拷贝的例子,自己改了改,欢迎大家品头论足。.
2021-03-25 11:35:36
88
原创 C# 将List<string>转换为List<double>
//string转List<double>List<string> strList = new List<string>();strList.Add("100"); strList.Add("500"); strList.Add("700");List<double> douList = strList.ConvertAll(s => Convert.ToDouble(s));string str = "600 650 700";List&.
2021-03-25 11:29:42
2624
1
原创 C# 读取或修改文件后缀
修改excel后缀文件为pdfstring pdfFileName = Path.ChangeExtension("C:\\test.xls", "pdf");
2021-02-20 17:04:31
412
原创 C# ContextMenuStrip
ContextMenuStrip 添加二级菜单选项 ContextMenuStrip cms = new ContextMenuStrip(); int itemsCnt = 0; cms.Items.Add("report-Excel "); cms.Items[itemsCnt].Click += new EventHandler((s1, e1) => ExportExcel()); itemsC
2021-02-20 14:30:30
922
原创 C# TreeView导出到Xml
C# TreeView导出到Xml1. TreeView树图如下:2. 保存代码如下:private void button3_Click(object sender, EventArgs e) { XmlDocument myXmlDoc = new XmlDocument(); XmlDeclaration xmldec = myXmlDoc.CreateXmlDeclaration("1.0", ...
2021-01-12 11:11:17
807
原创 C# TreeView读取Xml
1. Xml文本内容如下:<?xml version="1.0" encoding="UTF-8"?><xml> <Emp id="1" p_id=""> <name>CEO</name> </Emp> <Emp id="2" p_id="1"> <name>CTO</name> </Emp> <Emp id="3" p_id="1"> &l...
2021-01-12 10:34:14
591
原创 C# textbox实时输入值检测
检查textbox实时输入值是否为英文状态下的,分割符与数值(数值可正可负)private void textBoxMarker_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar >= '0' && e.KeyChar <= '9' || e.KeyChar == '-' || e.KeyChar == ',') {
2020-12-08 10:10:15
2191
原创 C# 实现状态切换 隐藏与显示输入密码
点击buttonShowPassword按钮,转换当前输入内容的展示效果private void buttonShowPassword_Click(object sender, EventArgs e) { showPW = !showPW; if (showPW) { textBoxPassword.PasswordChar = '\0';//输入密码以实际输入结果展示
2020-12-08 09:47:07
3484
原创 面试题解析
1. Unicode缺省是用16位来表示一个字的错。2. java程序的种类有()3. 基本数据类型均可以任意互相转换4.(1) 环境变量可在编译source code时指定(2) 在编译程序时,所能指定的环境变量不包括class path(3) javac一次可以编译数个java源文件(4) javac.exe能指定编译结果要置于哪个目录(direct...
2020-05-12 17:33:13
599
原创 C# 为节点添加修改图标
bool RangeLinePrintManagerSwitchifON = false;private void ribbonBtnRangeLinePrintManagerSwitch_Click(object sender, EventArgs e){ TreeNode node; if (NodeRight(out node)) { for (...
2019-10-25 16:53:55
413
1
原创 C# 获取list长度
C# 获取List长度List<List<List<double>>> dataList = new List<List<List<double>>>();dataList = this.Context.GetData;int lengthFirst = dataList.GetLength(0);//获取到一维的长...
2019-10-23 15:05:37
32285
5
原创 C# TreeView
TreeView的节点集合使用/// <summary>/// 用来记录正在测试的节点/// </summary>TreeNode node;/// <summary>/// 修改正在测试节点图标/// </summary>/// <param name="nodeColl">树节点集合</param>//...
2019-10-23 14:54:35
322
原创 C# 获取软件版本号
获取软件版本号var serverFileVersion = "";try{ string loadexeName = System.Windows.Forms.Application.ExecutablePath; //loadexeName : "D:\\YokiSystem\\Yoki.UI\\bin\\Debug\\Yoki.UI.exe" FileV...
2019-10-17 11:22:10
1184
原创 C# 在文件资源管理器打开功能
/// <summary>/// 右键在文件资源管理器打开功能/// </summary>public void OpenFolderAndSelectFile(string fileFullName){ System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStar...
2019-10-17 10:20:13
325
原创 C# TreeView节点删除的同时删除对应路径下的本地文件夹/文件
string localFilePath = node.ToolTipText;//localFilePath:节点保存路径FileAttributes attr = File.GetAttributes(localFilePath);//删除文件if (attr == FileAttributes.Directory)//文件夹 Directory.Delete(localFi...
2019-10-17 09:37:19
298
原创 判断字符串内是否含有空格
private bool ExitsBlank(string str){ bool blank = false; int num = str.IndexOf(" "); if (num == -1)//没空格 blank = false; else//有空格 blank = true; return blank;}...
2019-10-16 17:03:22
5291
原创 检测某个本地文件是否已存在
//nodeChange: D:\\myTest\\test8\\demo\\project\\project1//newName: project1if (Directory.Exists(nodeChange)){ treeView1.SelectedNode.EndEdit(true); string mess = "名为“" + newName + "”的文件在该路...
2019-10-14 15:39:17
636
原创 C# TreeView节点重命名
TreeView节点重命名时,发现新节点名与已有节点名重复,终止此次重命名if (nodeInfoList[i].nodeToolTipText == nodeChange){ treeView1.SelectedNode.EndEdit(true); MessageBox.Show("名为“" + newName + "”的项已存在,请为您要添加的项提供一个唯一的名称")...
2019-10-14 15:30:34
1730
原创 将某个路径下的所有文件复制到另一个路径下
private void CopyAll(string srcPath, string destPath) { try { DirectoryInfo dir = new DirectoryInfo(srcPath); FileSystemInfo[] fileinfo...
2019-10-07 16:32:38
489
原创 C# 获取当前路径的上一级(父级目录)
string path = "D:\\test\\test1\\demo";Directory.SetCurrentDirectory(Directory.GetParent(path).FullName);string parentPath = Directory.GetCurrentDirectory();//parentPath = D:\\test\\test1
2019-10-07 11:02:11
10694
4
原创 C#学习
1. system.console.write()和Console.write()有什么区别? 二者没用区别,表达同一个意思。如果在命名空间区域添加了Using System;就可以直接调用Console.write()。2.string s = string.Empty 与 "" 一般情况下,而这可以互换;3. c# backgroundimage 路...
2019-09-25 17:52:26
95
原创 小问题收集
问题:修改.exe的名称 问题描述:新建项目时,命名空间为Test,生成exe为Test.exe,现在想修改exe名称 解决方法: 右键项目-->属性-->应用程序-->程序集名称 双击项目下的Properties-->应用程序-->程序集名称 问题:设置CheckedListBox选中 解决办法:checkedList...
2019-07-16 10:43:58
91
原创 C#获取程序启动目录
C#获取程序启动目录public string exePath1 = System.Windows.Forms.Application.ExecutablePath;//"E:\\Ami.UI\\bin\\Debug\\Ami.UI.exe"public string StartupPath = Application.StartupPath;//"E:\\Ami.UI\\bin\\Deb...
2019-03-18 11:49:45
1141
2
原创 软件接口说明文档
软件接口说明文档1 引言1.1编写目的说明编写这份详细设计说明书的目的,指出预期的读者。1.2背景说明:a.待开发软件系统的名称;b.本项目的任务提出者、开发者、用户和运行该程序系统的计算中心。1.3定义列出本文件中用到专门术语的定义和外文首字母组词的原词组。1.4参考资料列出有关的参考资料,如:a.本项目的经核准的计划任务书或合同、上级机关的批文;b.属于本项目的其他...
2019-03-11 10:37:36
5804
原创 C# 字符串、int、double互转
string str = "100"; double num = 10; int count = 5;string temp = string.Empty;//int、double转stringtemp = count.ToString(); temp = num.ToString(); int index;double num2;//string转int、doublen...
2019-02-27 20:53:26
2907
原创 C# 判断字符串为空
if(text.Length == 0){}if(text == ""){}if(text = string.Empty{}三种判断方法
2019-02-27 20:43:18
772
原创 C# 字符串比大小
string latest = string.Empty;int result = -999;for(int i = 0; i < fileInfo.Length - 1; i++){ result = string.Compare(fileinfo[i].ToString(), fileinfo[i + 1].ToString()); if(result <...
2019-02-27 20:34:59
1517
原创 C# 获取当前路径的父路径
//获取当前运行路径的上级目录(父目录)System.IO.DirectoryInfo topDir = System.IO.Directory.GetParent(System.Environment.CurrentDirectory);//D:\项目\测试\test\bin\Debug//继续获取上级的上级的上级的目录。string pathto = topDir.Pa...
2019-02-27 14:03:39
6588
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人