zoukankan      html  css  js  c++  java
  • 填充闭合区域

    using System.Runtime.InteropServices;
     
    [DllImport(
    "gdi32.dll")]
    public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
    [DllImport(
    "gdi32.dll")]
    public static extern IntPtr CreateSolidBrush(int crColor);
    [DllImport(
    "gdi32.dll")]
    public static extern bool ExtFloodFill(IntPtr hdc, int nXStart, int nYStart,
        
    int crColor, uint fuFillType);
    [DllImport(
    "gdi32.dll")]
    public static extern bool DeleteObject(IntPtr hObject);
    [DllImport(
    "gdi32.dll")]
    public static extern int GetPixel(IntPtr hdc, int x, int y);
    public static uint FLOODFILLBORDER = 0;
    public static uint FLOODFILLSURFACE = 1;
     
    private void button1_Click(object sender, EventArgs e)
    {
        Graphics vGraphics 
    = Graphics.FromHwnd(Handle);
        vGraphics.DrawRectangle(Pens.Blue, 
    new Rectangle(00300300));
        vGraphics.DrawRectangle(Pens.Blue, 
    new Rectangle(5070300300));
        IntPtr vDC 
    = vGraphics.GetHdc();
        IntPtr vBrush 
    = CreateSolidBrush(ColorTranslator.ToWin32(Color.Red));
        IntPtr vPreviouseBrush 
    = SelectObject(vDC, vBrush);
        ExtFloodFill(vDC, 
    1010, GetPixel(vDC, 1010), FLOODFILLSURFACE);
        SelectObject(vDC, vPreviouseBrush);
        DeleteObject(vBrush);
        vGraphics.ReleaseHdc(vDC);
    }



    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zswang/archive/2007/05/22/1621529.aspx
  • 相关阅读:
    Webpack
    django 基础入门(二)
    django 基础入门(一)
    jQuery(二)
    JavaScripts+jquery
    html(第一天,div+css)
    SqlAlchemy ORM
    redis总结
    memcached总结
    Python (九) 协程以及数据库操作
  • 原文地址:https://www.cnblogs.com/wangshuai/p/1682806.html
Copyright © 2011-2022 走看看