Duplicate–do not use–Floodfill objects using C#
In order to flood fill drawn objects, you can make use of the next sample: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace FloodFill { public partial class Form1 : Form { public Form1() { InitializeComponent(); } Bitmap bm; Graphics g; private bool SameColor(Color c1, Color c2) { return ((c1.A == c2.A) && (c1.B == c2.B) && (c1.G == c2.G) && (c1.R == c2.R)); } private void tobien1(Bitmap bm, Point p, Color Color, Color LineColor) { Stack S = new Stack(); S.Push(p); while (S.Count != 0) { p = S.Pop();
