that is probably only way to call APIs directly, try to write a separate class which includes all the relevant APIs,seehttp://pinvoke.net/or write some COM object which encapsulates these APIs you need, and use RCW to call them

解决方案 »

  1.   

    [DllImport("gdi32.dll", EntryPoint="Rectangle")]
    public static extern int Rectangle (
    int hdc,
    int X1,
    int Y1,
    int X2,
    int Y2
    );先在类里定义,像这样,然后在函数可以调用了。
    介绍一个很好用的工具,定义都写好的,只要CV一下就可以。api精灵FOR C# 2.35,搜索google就有
      

  2.   

    因为VC有Windows头文件
    都是已经做好的
    其实,和C#一样
      

  3.   

    以下是我的一些想法,提出来大家讨论一下:
      先做一个类库工程,在里面声明常用的一些api函数,就象这样
    [DllImport("gdi32.dll", EntryPoint="Rectangle")]
    public static extern int Rectangle (
    int hdc,
    int X1,
    int Y1,
    int X2,
    int Y2
    );
      然后在需要时调用这个.dll文件就可以了
      

  4.   

    C#中尽量避免用API,因为C#已经能完成很多以前只有API才能完成的工作。
    实在要用的话,再申明一下,也不会花太多时间。