I'm creating a simply User Control. I have 4 Points and am trying to fill the area of the points using e.Graphics.FillPolygon(brush, shape);
shape
is created using Point[] shape = { Target, PointB, PointC, PointD };
Those points come from the following:
Point target = new Point(0, 0);
public Point Target {
get { return target; }
set { target = value; }
}
Point pointB = new Point(100, 0);
public Point PointB { get; set; }
// get { return pointB; }
// set { pointB = value; }
//}
Point pointC = new Point(0, 100);
public Point PointC {
get { return pointC; }
set { pointC = value; }
}
Point pointD = new Point(200, 500);
public Point PointD {
get { return pointD; }
set { pointD = value; }
}
My problem is that using public Point PointB { get; set; }
seems to not be working, so instead I have to write out the entire get { return pointB; } set { pointB = value; }
Is there something peculiar about the shorthand notation?
Using the longer (proper?) notation:
It appears as though it just ignores PointB
when using the shorthand notation.
Also, is it proper to have Point target = new Point(0, 0);
before or after the Accessor bit:
Point target = new Point(0, 0);
public Point Target {
get { return target; }
set { target = value; }
}
or
public Point Target {
get { return target; }
set { target = value; }
}
Point target = new Point(0, 0);