using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace WinAPI
{
    /// <summary>
    /// 
    /// </summary>
   public class GDI32
   {
        /// <summary>
        /// 删除一个逻辑笔、画笔、字体、位图、区域或者调色板，释放所有与该对象有关的系统资源，在对象被删除之后，指定的句柄也就失效了。
        /// </summary>
        /// <param name="hObject"></param>
        /// <returns></returns>
        [DllImport("gdi32")]
        public static extern bool DeleteObject(IntPtr hObject);
        /// <summary>
        /// 选择一对象到指定的设备上下文环境中，该新对象替换先前的相同类型的对象。
        /// </summary>
        /// <param name="hdc"></param>
        /// <param name="hgdiobj"></param>
        /// <returns></returns>
        [DllImport("gdi32")]
        public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
        /// <summary>
        /// 创建一个与指定设备兼容的内存设备上下文环境（DC）。
        /// </summary>
        /// <param name="hdc"></param>
        /// <returns></returns>
        [DllImport("gdi32", SetLastError = true)]
        public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
        /// <summary>
        /// 为一个设备创建设备上下文环境。
        /// </summary>
        /// <param name="driverName"></param>
        /// <param name="deviceName"></param>
        /// <param name="output"></param>
        /// <param name="lpInitData"></param>
        /// <returns></returns>
        [DllImport("gdi32")]
        public static extern IntPtr CreateDC(
          String driverName,
          String deviceName,
          String output,
          IntPtr lpInitData);
        /// <summary>
        /// 删除指定的设备上下文环境（Dc）。
        /// </summary>
        /// <param name="dc"></param>
        /// <returns></returns>
        [DllImport("gdi32")]
        public static extern bool DeleteDC(
          IntPtr dc);
    }
}
