以下是我在书上看见的一段代码,如果两者相同,为何作者要在同一段代码中应用两种不同的编程风格?都用DllImport不是简单多呢?
[DllImport("gdi32.dll")]
private static extern bool BitBlt(
IntPtr hdcDest, // hanlde to destination Dc (device context)
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
System.Int32 dwRop // raster operation code
);
[DllImport("gdi32.dll")]
private static extern IntPtr CreateDC(
String DriverName, // driver name
String DeviceName, // device name
String Output, // not used; should be NULL
IntPtr lpInitData // optional printer data
);
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
private static extern bool DeleteDC(
IntPtr dc
);