随笔分类 - C#
摘要:http://pan.baidu.com/s/1o6v88n4
阅读全文
摘要:using System;using System.Collections.Generic;using System.Text;using Memcached.ClientLibrary;using System.Diagnostics;namespace TestMemcachedApp{ ...
阅读全文
摘要:using (var p1 = new PerformanceCounter("Process", "Working Set - Private", "qq")) { label8.Text = ( p1.NextValue() / 1024).ToString(); }
阅读全文
摘要:[DllImport("user32.dll")] public static extern IntPtr SendMessage(IntPtr hWnd,int msg,int wparam,int lparam); protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == MouseButtons.Left)//按下的是鼠标左键 { Capture = false;//释放鼠标使能够手动操作 SendMessage(Handle, 0x00A1
阅读全文
摘要:WM_CREATE = &H0001 应用程序创建一个窗口 WM_DESTROY = &H0002 一个窗口被销毁 WM_MOVE = &H0003 移动一个窗口 WM_SIZE = &H0005 改变一个窗口的大小 WM_ACTIVATE = &H0006 一个窗口被激活或失去激活状态; WM_SETFOCUS = &H0007 获得焦点后 WM_KILLFOCUS = &H0008 失去焦点 WM_ENABLE = &H000A 改变enable状态 WM_SETREDRAW = &H000B 设置窗口是否能重画 WM
阅读全文
摘要:原文:http://hi.baidu.com/ytmeng/blog/item/25f5de5157931a888c543001.htmlusing System;using System.IO;using System.Threading;using System.Diagnostics;using System.Runtime.InteropServices;namespace XDF.GamePlugInCommon{ /// /// API 的摘要说明。 /// public sealed class API { //wMsg参数常量值: //WM_KEYDOWN 按下一个键 ...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Windows.Forms;using System.Reflection;namespace DMS{/// /// C#操作Excel类/// class ExcelOperate{//法一//public bool DataSetToExcel(DataSet dataSet, bool isShowExcle)//{// DataTable dataTable = dataSet.Tables[0]
阅读全文
摘要:Image baseImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); Graphics g = Graphics.FromImage(baseImage); g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.AllScreens[0].Bounds.Size); g.Dispose(); baseImage.Save("baseImage.jpg", ImageFormat.Jp
阅读全文
摘要://1、HTML直接转文本//使用方法HtmlToText convert = new HtmlToText();textBox2.Text = convert.Convert(textBox1.Text);//代码/// <summary>/// Converts HTML to plain text./// </summary>class HtmlToText{ // Static data tables protected static Dictionary<string, string> _tags; protected static HashSet
阅读全文
摘要:在我们编写程序的时候,有时候要进行复杂的查询时,就会出现执行sql时间过长,引起页面执行不了并提示执行脚本超时,这就是我们遇到超时异常。超时异常分两种情况:一种,是连接超时;一种,是执行超时。前者,通过SqlConnection.ConnectionTimeOut进行设置。后者,通过SqlCommand.CommandTimeOut进行设置。SqlConnection.ConnectionTimeout获取在尝试建立连接时终止尝试并生成错误之前所等待的时间。等待连接打开的时间(以秒为单位)。默认值为 15 秒。SqlCommand.CommandTimeout获取或设置在终止执行命令的尝试并生
阅读全文
摘要:在进行数据持久化的时候,我们会经常用到事务处理。一般情况下,ADO.NET中的事务处理就能够满足我们的需要,但是,ADO.NET中的事务不能同事对多个数据库连接进行原子性的操作;如果在你的业务环境中存在多个数据库、文件写入等操作,同时需要保证数据完整性和一致性的时候,你可以考虑使用.NET提供的分布式事务处理。 使用分布式事务处理,需要Windows系统的支持,所以,我们需要将系统的MSDTC服务开启。步骤:管理工具>组件服务;依次展开 控制台根节点>组件服务>计算机>我的电脑;在“我的电脑”节点上右键打开“属性”;在选项卡中勾选“使用本地协调器”,然后点击“确定”按钮
阅读全文
摘要:using System;using System.Data;using System.Data.SqlClient;using System.Data.SqlTypes;using Microsoft.SqlServer.Server;using System.Net;using System.IO;public partial class UserDefinedFunctions{ [Microsoft.SqlServer.Server.SqlFunction] public static SqlString GetWeb1(string IPURL) { // 在此处放置代码 retur
阅读全文
摘要:<html><head><script>function clear() {Source=document.body.firstChild.data;document.open();document.close();document.body.innerHTML=Source;}</script></head><body onload=clear()> Test</body></html>------------------隐藏网页源代码方法汇总1、将以下代码加入到HEML的<body>
阅读全文
摘要:<%@ Application Language="C#" %><script runat="server"> void Application_Start(object sender, EventArgs e) { // 在应用程序启动时运行的代码 } protected void Application_BeginRequest(Object sender, EventArgs e) { string rawUrl = Request.RawUrl; rawUrl = rawUrl.Replace("qanholas
阅读全文
摘要:代码的动态编译并执行是一个.NET平台提供给我们的很强大的工具用以灵活扩展(当然是面对内部开发人员)复杂而无法估算的逻辑,并通过一些额外的代码来扩展我们已有 的应用程序。这在很大程度上给我们提供了另外一种扩展的方式(当然这并不能算是严格意义上的扩展,但至少为我们提供了一种思路)。动态代码执行可以应用在诸如模板生成,外加逻辑扩展等一些场合。一个简单的例子,为了网站那的响应速度,HTML静态页面往往是我们最好的选择,但基于数据驱动的网站往往又很难用静态页面实现,那么将动态页面生成html的工作或许就是一个很好的应用场合。另外,对于一些模板的套用,我们同样可以用它来做。另外这本身也是插件编写的方式。
阅读全文
摘要:开始----运行---cmd回车-----cd c:/windows/microsoft.net/framework/v4.0.30319回车,然后输入aspnet_regiis.exe -ir就OK了
阅读全文
摘要:今天在 VS2005 的“服务器资源管理器”中的“数据连接”中新建一个连接时候提示:“该项不适于在指定状态下使用。” 把 VS2005 关掉再打开还是如此,重新启动计算机也不行。原因是:改了操作系统用户的登录密码的原因。解决办法:把目录下C:\Documents and Settings\Administrator\Application Data\Microsoft\VisualStudio\8.0\ServerExplorer的文件删除即可。
阅读全文
摘要:public partial class Form2 : DevExpress.XtraEditors.XtraForm { public Form2() { DevExpress.UserSkins.OfficeSkins.Register(); DevExpress.UserSkins.BonusSkins.Register(); DevExpress.Skins.SkinManager.EnableFormSkins(); InitializeComponent(); }
阅读全文
摘要:Windows 性能监视器概述Windows 性能监视器是一个 Microsoft 管理控制台 (MMC) 管理单元,提供用于分析系统性能的工具。仅从一个单独的控制台,即可实时监视应用程序和硬件性能,自定义要在日志中收集的数据,定义警报和自动操作的阈值,生成报告以及以各种方式查看过去的性能数据。 启动 Windows 性能监视器:开始-->运行—>输入perfmon-->回车添加-保存计数器设置:在Windows 2003中,添加完计数器后,直接按Ctrl+S,就能将设置保存为文件的形式,方便下次直接查看,在Win7中来的不那么直接。开始-->运行-->输入MMC
阅读全文
摘要:using System;using System.Collections.Generic;using System.Text;using System.IO; class Program { static void Main(string[] args) { Console.WriteLine("----------------------------------------------------"); Console.WriteLine("删除过期备份") ; FindAllFileAndDel(Action.Text.gettextbyline2
阅读全文