Help shape mapcontrol c#

Inscrit
4 Janvier 2017
Messages
19
Reactions
12
#1
need help for drawing obstacle in mapcontrol, map control it is bouh2 - https://cadernis.fr/index.php?threads/dofus-map-control-un-contrôle-pour-afficher-une-map.585/


C#:
public void DrawObstacle(Graphics g, Color borderColor, Color fillingColor)
        {
            using (GraphicsPath path = new GraphicsPath())
            {
                path.AddLines(new PointF[]
                {
                    new PointF(Puntos[3].X, Puntos[3].Y - 10),
                    new PointF(Puntos[0].X, Puntos[0].Y - 10),
                    new PointF(Puntos[1].X, Puntos[1].Y - 10),
                    new PointF(Puntos[2].X, Puntos[2].Y - 10),
                    new PointF(Puntos[3].X, Puntos[3].Y - 10)
                });

                path.AddLines(new PointF[]
                {
                    new PointF(Puntos[3].X, Puntos[3].Y - 10),
                    new PointF(Puntos[2].X, Puntos[2].Y - 10),
                    Puntos[2],
                    Puntos[3],
                    new PointF(Puntos[3].X, Puntos[3].Y - 10),
                });

                path.AddLines(new PointF[]
                {
                    new PointF(Puntos[2].X, Puntos[2].Y - 10),
                    new PointF(Puntos[1].X, Puntos[1].Y - 10),
                    new PointF(Puntos[2].X, Puntos[2].Y - 10),
                });

                using (SolidBrush brush = new SolidBrush(fillingColor))
                    g.FillPath(brush, path);

                using (Pen pen = new Pen(borderColor))
                    g.DrawPath(pen, path);
            }
        }

Screenshot_1.png

thanks ^^
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#2
I'm bad with Graphics but if you reverse the right side of the obstacle, you will have what you need, it's not difficult ^^
 

BlueDream

Administrateur
Membre du personnel
Inscrit
8 Decembre 2012
Messages
2 010
Reactions
149
#4
:D
 
Haut Bas