博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

07 2011 档案

摘要:语法DBCC CHECKIDENT ( 'table_name' [ , { NORESEED | { RESEED [ , new_reseed_value ] } } ] )如果标识列上有主键或唯一键约束,使用DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value) 当前值设置为new_reseed_value,这个时候需要注意:new_reseed_value 的值应该取当前标识列中的最大值,避免插入错误。示例A. 如有必要,重置当前标识值下例在必要的情况下重置 jobs 表的当前标识值。USE pu 阅读全文

posted @ 2011-07-26 14:55 itcfj 阅读(300) 评论(0) 推荐(0)

摘要:sqlserver 判断 游标是否存在 sqlserver 判断 游标是否存在2010-03-23 12:56sqlserver 判断 游标是否存在其中 first_cursor 是 游标名称if cursor_status('global','first_cursor')=-3 and cursor_status('local','first_cursor')=-3beginprint '不存在'endelsebeginprint '存在'end 阅读全文

posted @ 2011-07-26 09:28 itcfj 阅读(954) 评论(0) 推荐(0)

摘要:DataGridView在NET2.0中的编程小技巧DataGridView在NET2.0中的编程小技巧 目录: 1、 取得或者修改当前单元格的内容 2、 设定单元格只读 3、 不显示最下面的新行 4、 判断新增行 5、 行的用户删除操作的自定义 6、 行、列的隐藏和删除 7、 禁止列或者行的Resize 8、 列宽和行高以及列头的高度和行头的宽度的自动调整 9、 冻结列或行 10、 列顺序的调整 11、 行头列头的单元格 12、 剪切板的操作 13、 单元格的ToolTip的设置 14、 右键菜单(ContextMenuStrip)的设置 15、 单元格的边框、 网格线样式的设定 16、 单 阅读全文

posted @ 2011-07-25 17:21 itcfj 阅读(275) 评论(0) 推荐(0)

摘要:DataGridView 如何调整最后一列的宽度使其占据网格的剩余客户区 以默认方式填充DataGridView时,可能会发生因列的宽度不够,而暴露出控件的灰色背景的情况,很不美观。将最后一列的AutoSizeMode属性设置为Fill会使该列调整大小来填充网格的剩余客户区(client area)。作为一个可选的方式,你可以设置最后一列MinimumWidth属性,以保持该列的宽度不至于太小。 阅读全文

posted @ 2011-07-25 15:43 itcfj 阅读(772) 评论(0) 推荐(0)

摘要:在.NET上如何根据字符串动态创建控件 在.Net上用字符串动态创建控件是通过反射来实现。首先,利用System.Type.GetType方法,获得字符串中指定的控件的类型实例。这里需要注意这个字符串的语法,根据msdn的解释:按名称和签名隐藏会考虑签名的所有部分,包括自定义修饰符、返回类型、参数类型、标记和非托管调用约定。这是二进制比较。对于反射,属性和事件按名称和签名隐藏。如果基类中有同时带 get 访问器和 set 访问器的属性,但派生类中仅有 get 访问器,则派生类属性隐藏基类属性,并且您将无法访问基类的设置程序。自定义特性不是通用类型系统的组成部分。不对数组或 COM 类型执行搜索 阅读全文

posted @ 2011-07-23 22:33 itcfj 阅读(187) 评论(0) 推荐(0)

摘要:从 DataGridView 控件 托放数据 到 TreeView控件实现方法,在datagridview的mousedown事件中开始 托放。然后在treeview 的 DragEnter 中接收托放。最后在treeview的 DragDrop 中处理托放结果。注:treeview的allowdrop属性要设置为 true。:1privatevoiddataGridView1_MouseDown(objectsender,MouseEventArgse)2{3if(e.Button==MouseButtons.Right)4{5DataGridView.HitTestInfoinfo=dat 阅读全文

posted @ 2011-07-23 22:09 itcfj 阅读(189) 评论(0) 推荐(0)

摘要:DataGridView的一些技巧最近一直跟DataGridView打交道,突然觉得很多技巧性的东西很模糊,经过最近的个人实验操作和从网上查到的资料把对DataGridView操作的一些技巧总结和借鉴了一下,总结如下:1、自定义列 Customize Cells and Columns in the Windows Forms DataGridView Control by Extending Their Behavior and Appearance Host Controls in Windows Forms DataGridView Cells 继承 DataGridViewTextBo 阅读全文

posted @ 2011-07-23 21:26 itcfj 阅读(183) 评论(0) 推荐(0)

摘要:DataGridView 说明 ① 取得或者修改当前单元格的内容② 设定单元格只读③ 不显示最下面的新行④ 判断新增行⑤ 行的用户删除操作的自定义⑥ 行、列的隐藏和删除⑦ 禁止列或者行的Resize⑧ 列宽和行高以及列头的高度和行头的宽度的自动调整⑨ 冻结列或行⑩ 列顺序的调整? 行头列头的单元格? 剪切板的操作? 单元格的ToolTip的设置? 右键菜单(ContextMenuStrip)的设置? 单元格的边框、 网格线样式的设定? 单元格表示值的设定? 用户输入时,单元格输入值的设定? 设定新加行的默认值① DataGridView 取得或者修改当前单元格的内容:GO TO TOP当前单元 阅读全文

posted @ 2011-07-23 21:11 itcfj 阅读(213) 评论(0) 推荐(0)

摘要:DataGridViewCheckBoxColumn CheckBox是否选中 在判断DataGridView中CheckBox选中列的时候,用DataGridViewRow.Cells[0].FormattedValue.ToString()=="True"语句时存在问题,当我们直接点击CheckBox时,结果显示未选中,但是如果我们在点击其他单元格时,结果显示选中。而用DataGridViewRow.Cells[0].EditedFormattedValue.ToString()=="True"语句时不管怎么样是选中的状态。为什么会有这种结果? 原因 阅读全文

posted @ 2011-07-23 20:39 itcfj 阅读(855) 评论(0) 推荐(0)

摘要:第一种:Alt + *(按钮快捷键)在大家给button、label、menuStrip等控件设置Text属性时在名字后边加&键名就可以了,比如button1.text= "确定(&O)"。就会有快捷键了,这时候按Alt+O就可以执行按钮单击事件。第二种:Ctrl+*及其他组合键在WinForm中设置要使用组合键的窗体的KeyPreview(向窗体注册键盘事件)属性为True;然后使用窗体的KeyDown事件(在首次按下某个键时发生).实例代码:private void ***_KeyDown(object sender, KeyEventArgs e){i 阅读全文

posted @ 2011-07-23 20:27 itcfj 阅读(773) 评论(0) 推荐(1)

摘要:把datagridview 数据源转换为绑定的数据源 public class PlanInfo { /// <summary> /// 计划ID /// </summary> public int a { get; set; } /// <summary> /// 序号 /// </summary> public int b { get; set; } /// <summary> /// 发车 /// </summary> public string c { get; set; } }List<PlanInfo&g 阅读全文

posted @ 2011-07-21 23:30 itcfj 阅读(1677) 评论(0) 推荐(0)

摘要:c#中常用时间的使用C#中时间、日期的常用输出和存储方式比较还是用不好折叠 static void Main(string[] args) { //获取当前时间 Console.WriteLine(DateTime.Now); //序列化存储时间为二进制 long lTime; lTime = DateTime.Now.ToBinary(); Console.WriteLine(lTime); //反序列化二进制格式 string strTime = DateTime.FromBinary(lTime).ToString(); Console.WriteLine(strTime); //形式如 阅读全文

posted @ 2011-07-20 21:58 itcfj 阅读(166) 评论(0) 推荐(0)

摘要:自定义事件it using System;delegate viod CharEventHandler(object sender, CharEventArgs e);自定义了一个触发事件的参数public class CharEventArgs EventArgs{ public char CurrChar; public CharEventArgs(char CurrChar) { this.CurrChar = CurrChar; }}class CharChecker{ char curr_char;public event CharEventHandler CharTest;publ 阅读全文

posted @ 2011-07-20 20:47 itcfj 阅读(199) 评论(0) 推荐(0)

摘要:WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使 本篇介绍Winform程序开发中的布局界面的设计,介绍如何在我的共享软件中使用布局控件"WeifenLuo.WinFormsUI.Docking"。布局控件"WeifenLuo.WinFormsUI.Docking"是一个非常棒的开源控件,用过的人都深有体会,该控件之强大、美观、不亚于商业控件。而且控件使用也是比较简单的。先看看控件使用的程序界面展示效果。配电网络可视化管理系统的界面截图:深田之星送水管理系统网络版的界面截图:我在几个共享 阅读全文

posted @ 2011-07-19 23:56 itcfj 阅读(432) 评论(0) 推荐(0)

摘要:如何将Winform窗体最小化的时候将其显示到系统拖盘- 王大海 2009-03-02 05:51RT- 环零殇 2009-03-02 05:51抄来的: 先将窗体的Text属性设置为 "动画系统图标示例 ",MaximiseBox、MinimiseBox、ShowInTaskbar属性均设置为False。 再往窗体上添加NotifyIcon控件、ContextMenu控件各一个。 将NotifyIcon控件的Icon属性设置为一个图标文件,Name属性设置为“m_trayIcon”;ContextMenu属性设置为 "contextMenu1 ";接下 阅读全文

posted @ 2011-07-19 23:09 itcfj 阅读(290) 评论(0) 推荐(0)

摘要:c#用匿名方法传递参数给线程(可不用拆箱和装箱,传任意个参数) c#用匿名方法传递参数给线程(可不用拆箱和装箱,传任意个参数)将数据传入ThreadStart中话又说回来,在上面的例子里,我们想更好地区分开每个线程的输出结果,让其中一个线程输出大写字母。我们传入一个状态字到Go中来完成整个任务,但我们不能使用ThreadStart委托,因为它不接受参数,所幸的是,.NET framework定义了另一个版本的委托叫做ParameterizedThreadStart, 它可以接收一个单独的object类型参数:public delegate void ParameterizedThreadSta 阅读全文

posted @ 2011-07-19 23:05 itcfj 阅读(703) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/peterzb/tag/WinForm/ 阅读全文

posted @ 2011-07-17 22:46 itcfj 阅读(163) 评论(0) 推荐(0)

摘要:在CheckBox改变值得时候,执行需要的业务。summary 我的做法是,将焦点转移出去,触发CellValueChanged事件 summary public partial class Form1 Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { CreateData(); } summary 绑定数据 summary private void CreateData() { DataTable dtSource = new Da 阅读全文

posted @ 2011-07-17 22:05 itcfj 阅读(1207) 评论(0) 推荐(0)

摘要:关于DataGridView绑定数据源后未设置的列不显示dataGridView.AutoGenerateColumns = false; 阅读全文

posted @ 2011-07-17 22:03 itcfj 阅读(249) 评论(0) 推荐(0)

摘要:源码:WebCast20070608am_Demo.zip 阅读全文

posted @ 2011-07-17 18:46 itcfj 阅读(143) 评论(0) 推荐(0)

摘要:效果图:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace NotifyIconDemo{ public partial class Tray : Form { public Tray() { InitializeComponent(); } private void cToolStripMenuItem_C 阅读全文

posted @ 2011-07-17 18:40 itcfj 阅读(258) 评论(0) 推荐(0)

摘要:源码:WebCast20070608am_Demo.zip 效果:Form2 制作不规则窗体:Form2:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace MSNMessageForm{ public partial class Form2 : Form { private int heightMax, widt 阅读全文

posted @ 2011-07-17 18:27 itcfj 阅读(168) 评论(0) 推荐(0)

摘要:以前对WinForm窗体显示和窗体间传值了解不是很清楚最近做了一些WinForm开发,把用到的相关知识整理如下A.WinForm中窗体显示显示窗体可以有以下2种方法:Form.ShowDialog方法 (窗体显示为模式窗体)Form.Show方法 (窗体显示为无模式窗体)2者具体区别如下:1.在调用Form.Show方法后,Show方法后面的代码会立即执行2.在调用Form.ShowDialog方法后,直到关闭对话框后,才执行此方法后面的代码3.当窗体显示为模式窗体时,单击“关闭”按钮会隐藏窗体,并将DialogResult属性设置为DialogResult.Cancel 与无模式窗体不同,当 阅读全文

posted @ 2011-07-17 18:15 itcfj 阅读(181) 评论(0) 推荐(0)

摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Threading;using System.Windows.Forms;using System.Xml;namespace UseBackgroundWorker{ public partial class Form1 : Form { private XmlDocument document = null; public Form1() { InitializeCompone 阅读全文

posted @ 2011-07-17 18:12 itcfj 阅读(206) 评论(0) 推荐(0)

摘要:源码:WebCast20070601_Demo.zipusing System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.IO;//添加引用,以使用文件和目录类namespace ListView_TreeView{ /// <summary> /// 使用Treeview和ListView示例,产生和Windows资源管理器效果 /// </summary 阅读全文

posted @ 2011-07-17 18:10 itcfj 阅读(739) 评论(0) 推荐(0)

摘要:源码:WebCast20070601_Demo.zip //---------------------------------------------------------------------// This file is part of the Microsoft .NET Framework SDK Code Samples.// // Copyright (C) Microsoft Corporation. All rights reserved.// //This source code is intended only as a supplement to Microsoft/ 阅读全文

posted @ 2011-07-17 18:05 itcfj 阅读(663) 评论(0) 推荐(0)

摘要:每个scroll控件的using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace ScrollDemo{ public partial class Form1 : Form { Color backColor = Color.Black; public Form1() { InitializeComponent(); } 阅读全文

posted @ 2011-07-17 18:03 itcfj 阅读(227) 评论(0) 推荐(0)

摘要:把多个radioButton 放在同一个容器中using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace RadioButtonDemo{ public partial class Form1 : Form { private Color curColor; public Form1() { InitializeCompo 阅读全文

posted @ 2011-07-17 17:57 itcfj 阅读(222) 评论(0) 推荐(0)

摘要:方法一:把Form1 的属性设为位图:BackPic.bmp,using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace IrregularForm{ public partial class Form1 : Form { private Point mouseOffset; private bool isMouseDow 阅读全文

posted @ 2011-07-17 17:38 itcfj 阅读(226) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/joseph/articles/1636434.html 阅读全文

posted @ 2011-07-12 10:19 itcfj 阅读(190) 评论(0) 推荐(0)

摘要:本页内容概述组件介绍应用示例实现原理结束语概述在应用程序中,可能会遇到一些执行耗时的功能操作,比如数据下载、复杂计算及数据库事务等,一般这样的功能会在单独的线程上实现,执行结束后结果显示到用户界面上,这样可避免造成用户界面长时间无响应情况。在.NET 2.0及以后的版本中,FCL提供了BackgroundWorker组件来方便的实现这些功能要求。组件介绍BackgroundWorker类位于System.ComponentModel 命名空间中,通过该类在单独的线程上执行操作实现基于事件的异步模式。下面对BackgroundWorker类的主要成员进行介绍。BackgroundWorker类的 阅读全文

posted @ 2011-07-12 09:56 itcfj 阅读(270) 评论(0) 推荐(0)

摘要:http://www.codeproject.com/KB/cs/Hierarchical_Tree.aspx 阅读全文

posted @ 2011-07-11 17:41 itcfj 阅读(229) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/lzhdim/archive/2009/09/13/1565866.html 阅读全文

posted @ 2011-07-11 17:02 itcfj 阅读(144) 评论(0) 推荐(0)