我已经把 user32.dll 复制到当前文件夹里了
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Drawing.Printing;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
class AntiAlias : Form
{
public static void Main()
{
Application.Run(new AntiAlias());
}
public AntiAlias()
{
Text = "Anti-Alias Demo";
BackColor = SystemColors.Window;
ForeColor = SystemColors.WindowText;
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[DllImport(user32.dll)]
public static extern int ScrollWindow(IntPtr hwnd,int cx, int cy,
ref RECT rectScroll,
ref RECT rectClip);
}
错误 1 当前上下文中不存在名称“user32” C:\Users\hrao\Desktop\Project1\Project1\InheritHelloWorld.cs 29 15 Project1
------解决思路----------------------
http://www.cnblogs.com/goed/archive/2011/11/10/2243965.html
首先[DllImport(user32.dll)]是错误的应该是[DllImport("user32.dll")]
------解决思路----------------------
[DllImport("user32.dll")]