C#利用winapi定位控件位置算法
public struct RECT
{
public int left;
public int Top;
public int Right;
public int Bottom;
}
public static bool CenterMouseOn(int hwnd)
{
int x=0;
int y=0;
int maxX=0;
int maxY=0;
RECT crect=new RECT();
int gFound=0;
GetDisplayResolution(ref maxX,ref maxY);
gFound=GetWindowRect(hwnd,ref crect);
x=crect.Left+((crect.Right-crect.Left)/2);
y=crect.Top+((crect.Bottom-crect.Top)/2);
if((x>=0&&x<=maxX)&&(y>=0&&y<=maxY))
{
MoveMouse(hwnd,x,y);
return true;
}
return false;
}
public static void GetDisplayResolution(ref int pixelX,ref int pixelY)
{
pixelX=GetSystemMetrics(SM_CXSCREEN);
pixelY=GetSystemMetrics(SM_CYSCREEN);
}
相关文档:
这些天因为工作需要,要将一些html文件转换为chm文件,当然是需要和程序结合在一起。
后来找到NDoc,里头有一段代码是相关的,于是开始分析代码,写完之后,总结:主要是利用微软的hhc.exe来编译html文件,程序需要将具体的数据写入hhp和hhc文件。
主要代码如下:
复制C#代码保存代码public void CompileProject()
{ ......
a. ReportViewer关联Report1.rdlc的简单呈现
b. 对带有报表参数的Report1.rdlc的呈现
c.
利用程式生成的DataSet 填充报表
d. 调用存储过程 生成DataSet 填充报表
==========
简单的呈现
==========
1. 打开VS2005,文件->新建->网站 选择语言种类(C#)
2. 在该解决方案下
设计其已经生成的Default.aspx ......
C#正则表达式编程(三):Match类和Group类用法 收藏 此文于2010-03-09被推荐到CSDN首页
如何被推荐?
前面两篇讲述了正则表达式的基础和一些简单的例子,这篇将稍微深入一点探讨一下正则表达式分组,在.NET中正则表达式分组是用Math类来代表的。
首先先看一段代码:
view plaincopy to clipboardprint?
/// &l ......
在net中有一个至关重要的关键字,那就是using
using一般有着以下几种用法:
1、直接引入命名空间
a、using System ,这个是最常用的,就是using+命名空间,这样就可以直接使用命名空间中的类型,而免去了使用详细的命名空间
b、使用全限定名
不用使用using System;直接在程序中调用System.Console.WriteLine("Hello ......
我们做了程序,不免会有版本升级,这就需要程序有自动版本升级的功能。
那么看看我是如何实现程序自动更新的。
直接上代码:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.IO;
using System.Net;
using System.Xml;
namespace ......