无法在 DLL“gdi32”中找到名为“SetBKMode”的入口点
书上的一个例子,我照着输入程序,运行时出现“无法在 DLL“gdi32”中找到名为“SetBKMode”的入口点”请问是什么原因啊?
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace circlewindow
{
public partial class Form1 : Form
{
[System.Runtime.InteropServices.DllImport("gdi32")]
private static extern IntPtr BeginPath(IntPtr hdc);
[System.Runtime.InteropServices.DllImport("gdi32")]
private static extern int SetBKMode(IntPtr hdc, int nBKMode);
const int TRSPARENT = 1;
[System.Runtime.InteropServices.DllImport("gdi32")]
private static extern IntPtr EndPath(IntPtr hdc);
[System.Runtime.InteropServices.DllImport("gdi32")]
private static extern IntPtr PathToRegion(IntPtr hdc);
[System.Runtime.InteropServices.DllImport("gdi32")]
private static extern int Ellipse(IntPtr hdc, int x1, int y1, int x2, int y2);
[System.Runtime.InteropServices.DllImport("user32")]
private static extern IntPtr SetWindowRgn(IntPtr hdc, IntPtr hRgn, bool bRedraw);
[System.Runtime.InteropServices.DllImport("user32")]
private static extern IntPtr GetDC(IntPtr hWnd);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
IntPtr dc;
IntPtr region;
dc = GetDC(this.Handle);
BeginPath(dc);
SetBKMode(dc, (int)TRSPARENT);
Ellipse(dc, 20, 20, 220, 220);
EndPath(dc);
region = PathToRegion(dc);
SetWindowRgn(this.Handle, region, true);
}
}
}