徐胜利

导航

2012年10月9日 #

WinForm单实例启动

摘要: using System;using System.Collections.Generic;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Diagnostics;using System.Reflection;namespace AppLed{ static class Program { //防止程序运行多个实例的方法有多种,如:通过使用互斥量和进程名等.而我想要实现的是:在程序运行多个实例时激活的是第一个实例,使其获得焦点,并在前端显示. //主要用到两个API 函数: //Show 阅读全文

posted @ 2012-10-09 20:33 xuvictory 阅读(841) 评论(0) 推荐(0)

2012年9月28日 #

客户端与服务器时间同步命令

摘要: 在cmd中输入如下命令: net time \\服务器Ip /set /y 可将本机时间与指定的服务器时间同步扩展:通过修改注册表实现客户端与服务器端实现时间同步服务器端设置:1,修改注册表以下项的键值HKEY_Local_Machine\System\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer 内的“Enable”设置为“1”,打开时间同步服务功能。2,修改以下键值HKEY_Local_Machine\System\CurrentControlSet\Services\W32Time\Config里面的“Announc 阅读全文

posted @ 2012-09-28 22:47 xuvictory 阅读(2556) 评论(0) 推荐(0)

2012年9月18日 #

TreeView常用方法随记

摘要: //展开所有子节点foreach(TreeNode node in this.TreeV_Menu.Nodes){ node.ExpandAll();}//设置滚动条在顶端if (this.TreeV_Menu.Nodes.Count > 0){ this.TreeV_Menu.Nodes[0].EnsureVisible(); //确保树节点可见,并在必要时展开树节点和滚动树视图控件}//获取指定节点private TreeNode Sub_GetTreeNode(string Str_Tag){ TreeNode TreeNode_Result = null; foreach (T. 阅读全文

posted @ 2012-09-18 17:07 xuvictory 阅读(165) 评论(0) 推荐(0)

2012年9月12日 #

为DataGridView添加行号

摘要: 一,为DataGridView添加RowPostPaint事件二,为该事件添加如下代码private void dgvShow_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e){Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, this.dgvShow.RowHeadersWidth - 4, e.RowBounds.Height); TextRenderer.Dra... 阅读全文

posted @ 2012-09-12 19:19 xuvictory 阅读(208) 评论(0) 推荐(0)

2012年8月25日 #

C#单独改变DataGridView按钮列中某个按钮的文本

摘要: 功 能:改变单个按钮的文本注意事项: 1, 将DataGridViewButtonColumn列属性UseColumnTextForButtonValue设为false,意为不用按钮Text属性来显示按钮文本; 2, 将DefaultCellStyle里面属性NullValue设置为按钮文本 3, 在DataGridView1里面CellClick事件里面添加如下代码 Private void DataGridView1_CellClick(Object sender,DataGridViewCellEventArgs e) { ... 阅读全文

posted @ 2012-08-25 10:53 xuvictory 阅读(3174) 评论(0) 推荐(0)

2011年12月9日 #

用udl文件配置数据库连接字符串

摘要: 简介 udl(Universal Data Link)是通用数据连接文件,使用通用数据链接 (UDL) 文件来保存连接字符串。 使用 UDL 文件存储数据库连接的方式和使用“ODBC 数据源名称 (DSN)”非常相似。UDL 文件存储 OLE DB 连接信息,例如提供程序、用户名、密码和其他选项。用存储在该 UDL 文件中的信息可以打开 ADO 连接,从而允许管理员在需要的情况下更改它,并且避免了打开注册表或者使用 ODBC。 也就是说这个里面包含的东西就是CONNECTIONSTRING 中的内容,比如: ‘Provider=Microsoft.Jet.OLEDB.4.0;Data ... 阅读全文

posted @ 2011-12-09 11:41 xuvictory 阅读(1807) 评论(0) 推荐(0)

2011年12月6日 #

常用webservice查询地址

摘要: WEB 服务地址查询页面: http://www.webxml.com.cn/zh_cn/web_services.aspx 阅读全文

posted @ 2011-12-06 14:13 xuvictory 阅读(454) 评论(3) 推荐(0)

2011年11月25日 #

启动窗体时右下角显示

摘要: 输入下面这行代码即可实现private void Form_Load(object sender,EventArgs e){ this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height);} 阅读全文

posted @ 2011-11-25 12:22 xuvictory 阅读(200) 评论(0) 推荐(0)

2011年11月23日 #

cmd命令nslookup

摘要: 在cmd命令中输入 nslookup + ip别名查询结果中第二条结果里面的ip地址就是该ip地址。 阅读全文

posted @ 2011-11-23 12:20 xuvictory 阅读(233) 评论(0) 推荐(0)

2011年11月21日 #

数据集DataSet和指定Xml数据的字符串之间的相互转换

摘要: 一,数据集DataSet转换为String DataSet ds = new DataSet(); ds.ReadXml();二,String转换成DataSet的方法 XmlDocument doc = new XmlDocument(); doc.LoadXml("");//指定xml格式数据字符串 XmlNodeReader reader = new XmlNodeReader(doc); DataSet ds = new DataSet(); ds.ReadXml(reader); reader.Close(); 阅读全文

posted @ 2011-11-21 18:49 xuvictory 阅读(200) 评论(0) 推荐(0)