public Select(Position position, Rectangle container, bool next) : base("", position, new Position(1,1), container, next ? "SelectNext" : "SelectPrev") { arrowOrientation = next ? Lcd.ArrowOrientation.Right : Lcd.ArrowOrientation.Left; arrowRect = new Rectangle (new Point (outherBox.P1.X + 3 * characterEdge, outherBox.P1.Y + 3 * characterEdge), new Point (outherBox.P2.X - 3 * characterEdge, outherBox.P2.Y - 3 * characterEdge)); }
public void DrawArrow(Rectangle r, Lcd.ArrowOrientation orientation, bool color) { int height = r.P2.Y - r.P1.Y; int width = r.P2.X - r.P1.X; float inc = 0; if (orientation == Lcd.ArrowOrientation.Left || orientation == Lcd.ArrowOrientation.Right) { inc = (((float)height) / 2.0f) / ((float)width); } else { inc = (((float)width) / 2.0f) / ((float)height); } if (orientation == Lcd.ArrowOrientation.Left) { for (int i = 0; i < width; i++) { SetPixel((int)(r.P1.X + i), (int)(r.P1.Y + height / 2), color); int points = (int)(inc * (float)i) + 1; for (int j = 0; j < points; j++) { SetPixel((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 + j), color); SetPixel((int)(r.P1.X + i), (int)(r.P1.Y + height / 2 - j), color); } } } if (orientation == Lcd.ArrowOrientation.Right) { for (int i = 0; i < width; i++) { SetPixel((int)(r.P2.X - i), (int)(r.P1.Y + height / 2), color); int points = (int)(inc * (float)i) + 1; for (int j = 0; j < points; j++) { SetPixel((int)(r.P2.X - i), (int)(r.P1.Y + height / 2 + j), color); SetPixel((int)(r.P2.X - i), (int)(r.P1.Y + height / 2 - j), color); } } } if (orientation == Lcd.ArrowOrientation.Up) { for (int i = 0; i < height; i++) { SetPixel((int)(r.P1.X + width / 2), (int)(r.P1.Y + i), color); int points = (int)(inc * (float)i) + 1; for (int j = 0; j < points; j++) { SetPixel((int)(r.P1.X + width / 2 + j), (int)(r.P1.Y + i), color); SetPixel((int)(r.P1.X + width / 2 - j), (int)(r.P1.Y + i), color); } } } if (orientation == Lcd.ArrowOrientation.Down) { for (int i = 0; i < height; i++) { SetPixel((int)(r.P1.X + width / 2), (int)(r.P2.Y - i), color); int points = (int)(inc * (float)i) + 1; for (int j = 0; j < points; j++) { SetPixel((int)(r.P1.X + width / 2 + j), (int)(r.P2.Y - i), color); SetPixel((int)(r.P1.X + width / 2 - j), (int)(r.P2.Y - i), color); } } } }
public Select(Position position, Rectangle container, bool next) : base("", position, new Position(1, 1), container, next ? "SelectNext" : "SelectPrev") { arrowOrientation = next ? Lcd.ArrowOrientation.Right : Lcd.ArrowOrientation.Left; arrowRect = new Rectangle(new Point(outherBox.P1.X + 3 * characterEdge, outherBox.P1.Y + 3 * characterEdge), new Point(outherBox.P2.X - 3 * characterEdge, outherBox.P2.Y - 3 * characterEdge)); }
public static void DrawArrow(Rectangle r, Lcd.ArrowOrientation orientation, bool color) { Instance.DrawArrow(r, orientation, color); }