易截截图软件、单文件、免安装、纯绿色、仅160KB

C#开发实例

c#改变系统鼠标
---------------------------------------------------------------------------------------------------
using System.Runtime.InteropServices;
 
[DllImport("User32.DLL")]
public static extern bool SetSystemCursor(IntPtr hcur, uint id);
public const uint OCR_NORMAL = 32512;
public const uint OCR_IBEAM = 32513;
 
[DllImport("User32.DLL")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam,
    IntPtr pvParam, uint fWinIni);
public const uint SPI_SETCURSORS = 87;
public const uint SPIF_SENDWININICHANGE = 2;
private void button1_Click(object sender, EventArgs e)
{
    //设置
    SetSystemCursor(Cursors.WaitCursor.CopyHandle(), OCR_NORMAL);
    SetSystemCursor(Cursors.WaitCursor.CopyHandle(), OCR_IBEAM);
    //..可以根据情况加
}
 
private void button2_Click(object sender, EventArgs e)
{
    //恢复
    SystemParametersInfo(SPI_SETCURSORS, 0, IntPtr.Zero, SPIF_SENDWININICHANGE);
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zswang/archive/2007/03/20/1535309.aspx
------------------------------------------------------------------------------------------------------------
C#鼠标拖动控件改变位置并绘制虚框
-------------------------------------------------------------------------------------------------------------
private Point downPoint;
private Rectangle downRectangle;
private Rectangle lastRectangle;
 
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button != MouseButtons.Left) return;
    downPoint = e.Location;
    downRectangle =
        new Rectangle(0, 0, ((Control)sender).Width, pictureBox1.Height);
    downRectangle.Offset(((Control)sender).PointToScreen(new Point(0, 0)));
    ControlPaint.DrawReversibleFrame(
 


相关文档:

C#面试笔试小贴士 2

对于多态,还必需提一个C#中的关键字:new。前面提到,对于virtual方法,JIT会确定实例的实际类型然后决定调用什么方法。但是如果派生类中new关键字修饰方法,则它向CLR澄清此派生类中的方法与基类中的方法毫无关系,以下代码最终调用是基类的introduce方法:
Code
class Program
{
    static vo ......

C# aspx 数据绑定方法集

Eval("")和Bind("") 这两种一个单向绑定,一个双向绑定,bind是双向绑定,但需数据源支持
ASP.NET   2.0改善了模板中的数据绑定操作,把v1.x中的数据绑定语法DataBinder.Eval(Container.DataItem,   fieldname)简化为Eval(fieldname)。Eval方法与DataBinder.Eval一样可以接受一个可选的格式化字符串参 ......

c# 的namespace以及assembly

1 NameSapce

1 1个namespace里面可以有多个类
2  namespace和cs文件是多对多的关系。
3  调用另一个namespace的声明,可以使用using <namespace> ,然后直接调用类名,或者使用namespace.类名来调用
4  namespace支持别名(alias)   using namespace = namespace.classname,如using m ......

Socket编程(C#)

//Socket基本编程
//服务端:
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
Thread mythread ;
Socket socket;
// 清理所有正在使用的资源。
protected override void Dispose( bool disposing )
{
try
  {   
   socket.Close();//释放资源 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号