随笔分类 -  C#.NET

1 2 下一页

C#字符串内多个空格合并成1个
摘要:public static string CombineInsideSpaces(string orinStr) { List<int> poses = new List<int>(); for (int i = 0; i <= orinStr.Length - 1; i++) {//获取所有空格位置 if (orinStr[i] == ' ') { poses.Add(i); } } ... 阅读全文

posted @ 2012-11-22 09:44 imihiro 阅读(2372) 评论(0) 推荐(0)

C# List.Sort() 排序; DataView 对DataTable 排序
摘要:List<string> sortedHeight = new List<string>(); foreach (var cs in contourDoc.SelectNodes("Xml/ContourSet")) { XmlElement tempEle = cs as XmlElement; sortedHeight.Add(tempEle.Attributes["height"].Value); } sortedHeight.Sor... 阅读全文

posted @ 2012-07-13 17:23 imihiro 阅读(2487) 评论(0) 推荐(0)

Asp.NET DevelopmentServer 固定端口号
摘要:2010-09-07 10:20ASP.NET Development Server 固定端口号用 ASP.NET Development Server 运行文件系统网站时,默认情况下在随机选择的 localhost 端口上调用 Web 服务器。例如,如果要测试名为 MyPage.aspx 的页,则在 ASP.NET Development Server 上运行该页时,该页的 URL 可能是:http://localhost:31544/MyPage.aspx如果要在特定端口上运行 ASP.NET Development Server,可以为此相应地配置服务器。注意 Visual Web De 阅读全文

posted @ 2012-07-02 23:56 imihiro 阅读(4192) 评论(0) 推荐(1)

Xml 根据路径和属性值获取节点
摘要:XmlDocument xmlDoc = getXmlDoc.GetXmlDocByXmlName("材料信息");//获取config目录下 材料信息.xml XmlNodeList nodeList = xmlDoc.SelectNodes("/root/talbeName[@name='主表名']");//主表节点集合获取root/tablename 并且 tablename的name属性为主表名 的节点。 阅读全文

posted @ 2012-06-28 10:34 imihiro 阅读(4201) 评论(0) 推荐(1)

C# 客户端程序打包(制作exe)
摘要:123 阅读全文

posted @ 2012-06-27 10:27 imihiro 阅读(647) 评论(0) 推荐(0)

C# 字符串 包含中文
摘要:/// <summary> /// 判断字符串 是否含有中文 /// </summary> /// <param name="str"></param> /// <returns></returns> private bool ContainCHChar(string str) { int chnfrom = Convert.ToInt32("4e00", 16); int chnend = Convert.ToInt32("9fff",16); ... 阅读全文

posted @ 2012-06-25 21:20 imihiro 阅读(761) 评论(0) 推荐(0)

C# 文件夹拷贝 迭代
摘要:/// <summary> /// 文件夹拷贝 /// </summary> /// <param name="sourDir"></param> /// <param name="projectID"></param> /// <param name="programID"></param> /// <returns></returns> private static bool CopyTo(DirectoryIn 阅读全文

posted @ 2012-06-25 16:12 imihiro 阅读(331) 评论(0) 推荐(0)

C# DateTimePicker控件设置空时间
摘要://在DateTime旁边添加一个清空按钮. private void btnClearRegTime_Click(object sender, EventArgs e) { MessageBox.Show("Text:" + dtpRegTime.Text + "\nValue:" + dtpRegTime.Value.ToString()); dtpRegTime.CustomFormat = " "; MessageBox.Show("Text:" + dtpRegTime.Text + "... 阅读全文

posted @ 2012-06-18 10:47 imihiro 阅读(2551) 评论(0) 推荐(0)

C# DateTime赋值为null
摘要:DateTime和int,double一样,是值类型。在任何情况下都有值.解决方式是赋值一个不会被用的值,比如DateTime.MinValue; 阅读全文

posted @ 2012-06-18 10:20 imihiro 阅读(5700) 评论(0) 推荐(0)

C# DateTimePicker格式设置
摘要://必须先设置Format属性为Custom,然后才能自定义格式 this.dtPicker.Format = DateTimePickerFormat.Custom; this.dtPicker.CustomFormat = "yyyy-MM-dd";效果为:2012-06-13yyyy代表年MM 代表月 (区分大小写)dd代表日期 (dddd代表星期几)具体请继续尝试 阅读全文

posted @ 2012-06-13 14:50 imihiro 阅读(15161) 评论(0) 推荐(1)

C# WebBrowser显示html字符串
摘要:public void NavigateToUrl(string url) { this.webBrowser1.Navigate(url); } public void ShowHtmlStr(string htmlStr) { this.webBrowser1.DocumentText = htmlStr; } 阅读全文

posted @ 2012-06-12 16:16 imihiro 阅读(7876) 评论(0) 推荐(0)

C# Math函数 字符串、整数装换
摘要:(1)16进制字符串转整数 //常用于string 颜色转 int color (例如#ffffff转 65535) string argb=node.SelectSingleNode("RenderStyle/PenStyle/PenColor").InnerText; int rgbValue = Convert.ToInt32(argb, 16); var colorSet = new string[] { "#ff880000", "#ffff0000", "#ff008800", "#ff00f 阅读全文

posted @ 2012-06-12 11:06 imihiro 阅读(645) 评论(0) 推荐(0)

C# 按钮美化技巧
摘要:(1)按钮 text设置成""(2)按钮backgroundImage设置成 想要的图片(3) ToolTip属性设置成 鼠标在上时的提示 (比如“搜索”、“删除”、“查找”) 阅读全文

posted @ 2012-06-08 16:14 imihiro 阅读(1773) 评论(0) 推荐(0)

C# TreeView Xml文件 处理优先级
摘要:xml文件作为“数据库”C# 类(如TrackManager,routparameter)作为 业务层类C# TreeView作为展示数据的界面处理技巧: 张弓先强, 擒贼先王 更新xml方法-->更新业务层类-->更新界面树 阅读全文

posted @ 2012-06-05 09:18 imihiro 阅读(298) 评论(0) 推荐(0)

visual studio 调试技巧
摘要:(1)条件命中 for(int i=0;i<=99;i++){ int k=i*i; //想在i==98为true的时候,察看k的值.怎么做? 一次次按F5,按98次. No} 解决方式: “调试”菜单-->窗口-->断点 在列表中,找到断点。 右键点击改行-->选择条件。 填入i==98. 阅读全文

posted @ 2012-06-04 15:55 imihiro 阅读(195) 评论(0) 推荐(0)

C# treeview右键菜单 设置技巧
摘要://在NodeMouseClick事件中 再将cms设定成treeview的cms. 这样点空,不会出现右键菜单. //右键菜单 private void tv_Roots_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button != MouseButtons.Right) return; if (e.Node.Parent == null || e.Node == null) return; tv_Roots.SelectedNode = e.Node; cmsRouts.Show(tv_Root 阅读全文

posted @ 2012-06-02 14:45 imihiro 阅读(13338) 评论(2) 推荐(0)

C# 创建xml文档. xml文件中有中文字符,无法用浏览器显示
摘要:XmlDocument doc = new XmlDocument(); XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "GB2312", null); doc.AppendChild(dec); //创建一个根节点(一级) XmlElement root = doc.CreateElement("First"); doc.AppendChild(root);//xml文件包含中文字符,且没有说明xml编码格式时.就无法被xmlDocument对象和IE识别。 解决方式,在x 阅读全文

posted @ 2012-05-25 18:12 imihiro 阅读(379) 评论(0) 推荐(0)

C# 类型取值范围
摘要:帮助-->如何实现 阅读全文

posted @ 2012-05-23 09:05 imihiro 阅读(230) 评论(0) 推荐(0)

CS-- WebService、 windowsService
摘要:一、WebServiceWebService就是Asp.NET Web服务在新建-->VisualC#-->Web-->Asp.NET Web服务应用程序http://www.cnblogs.com/denylau/archive/2010/07/23/1783530.htmlService端如何添加方法? [WebMethod] public string HelloWorld() { return "Hello World"; }Service端如何添加静态类?将静态类添加到App_Code目录下.即可在Service.cs中引用客户端如何调用方法?h 阅读全文

posted @ 2012-05-14 16:50 imihiro 阅读(834) 评论(0) 推荐(0)

List 排序功能实现
摘要:public class ClippedRasterComparer : IComparer<ClippedRaster> { public int Compare(ClippedRaster clr1, ClippedRaster clr2) { //return clr1._absoluteVolume.CompareTo(clr2._absoluteVolume);//升序 return clr2._absoluteVolume.CompareTo(clr1._absoluteVolume);//降序 ... 阅读全文

posted @ 2012-05-11 16:10 imihiro 阅读(272) 评论(0) 推荐(0)

1 2 下一页