Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How to make groups with Graphic things?

$
0
0

hey ,

what I want is that>> I have several Graphic
Circles on my form which they created from a Class and all of
them(circles) have their properties like coordinate,ID,...and also they
create in random coordinates SO>>     HOw can I group the colse
ones

 this is the Class that I use:

public class MyNode
    {
        public PointF LocNde { get; set; }
        public SizeF Size { get; set; }
        public Color Color { get; set; }
        public int ID { get; set; }
         public MyNode()
        {
            LocNde = new PointF(0, 0);
            Size = new SizeF(_rnd.Next(0,500),_rnd.Next(0,500));
            Color =  Color.White; 
        }
        public void Render(Graphics g)
        {

            using (SolidBrush p = new SolidBrush(Color))
                g.FillEllipse(p, new RectangleF(LocNde, Size));
          }
        
              }

also I use this code to create 10 of them

for (int i = 0; i < 10; i++)
            {

                                     
                                    MyNode el = new MyNode() {ID = i};
      panel1._Node.Add(el);
            //_Node is a List of MyNode          
                }

I want to just group the close ones like this:

Plz give some ways and clues to do this


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>