first commit because I dont want to lose this project
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Caisses
|
||||
{
|
||||
internal class GraphicalCheckout : Checkout
|
||||
{
|
||||
private Point _position;
|
||||
private Color _color;
|
||||
private Size _size;
|
||||
private Rectangle _area;
|
||||
private Random Random;
|
||||
|
||||
public Point Position { get => _position; set => _position = value; }
|
||||
public Color Color { get => _color; set => _color = value; }
|
||||
public Size Size { get => _size; set => _size = value; }
|
||||
public Rectangle Area { get => _area; set => _area = value; }
|
||||
public GraphicalCheckout(Point position,Rectangle area,int checkoutNumber)
|
||||
{
|
||||
Random = new Random();
|
||||
Position = position;
|
||||
Color = Color.FromArgb(Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255));
|
||||
Size = new Size(area.Width / checkoutNumber + 1,area.Height-area.Height/10);
|
||||
}
|
||||
public void Draw(Bitmap checkoutAreaImage)
|
||||
{
|
||||
Graphics g = Graphics.FromImage(checkoutAreaImage);
|
||||
//g.DrawRectangle(new Pen(Color.FromArgb(Random.Next(0,255),Random.Next(0,255),Random.Next(0,255))),new Rectangle(Position,Size));
|
||||
g.DrawRectangle(new Pen(Color.Black),new Rectangle(Position,Size));
|
||||
if (Open)
|
||||
{
|
||||
g.FillRectangle(new SolidBrush(Color.Green),new Rectangle(Position, Size));
|
||||
g.DrawString(Clients.Count().ToString(), new Font("Arial", 16), new SolidBrush(Color.White), new PointF(Position.X, Position.Y));
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillRectangle(new SolidBrush(Color.Red), new Rectangle(Position, Size));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user