public class Mypanel : Panel
{
public Mypanel(int width, int height)
{
Width = width;
Height = height;
}
protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
e.Canvas.Clear(SKColors.Black);
// Outer wallpaper
var img = MapImages.PanelOuterWallpaper;
for (int row = 0; row <= Size.Height / img.Height; row++)
{
for (int col = 0; col <= Size.Width / img.Width; col++)
{
e.Canvas.DrawBitmap(img, new SKPoint(col * img.Width, row * img.Height));
}
}
// Paint panel borders
// Outer border
var paint1 = new SKPaint { Color = new SKColor(227, 227, 227) };
var paint2 = new SKPaint { Color = new SKColor(105, 105, 105) };
var paint3 = new SKPaint { Color = new SKColor(255, 255, 255) };
var paint4 = new SKPaint { Color = new SKColor(160, 160, 160) };
var paint5 = new SKPaint { Color = new SKColor(240, 240, 240) };
var paint6 = new SKPaint { Color = new SKColor(223, 223, 223) };
var paint7 = new SKPaint { Color = new SKColor(67, 67, 67) };
e.Canvas.DrawLine(new SKPoint(0, 0), new SKPoint(Size.Width - 2, 0), paint1);
e.Canvas.DrawLine(new SKPoint(0, 0), new SKPoint(0, Size.Height - 2), paint1);
e.Canvas.DrawLine(new SKPoint(Size.Width - 1, 0), new SKPoint(Size.Width - 1, Size.Height - 1), paint2);
e.Canvas.DrawLine(new SKPoint(0, Size.Height - 1), new SKPoint(Size.Width - 1, Size.Height - 1), paint2);
e.Canvas.DrawLine(new SKPoint(1, 1), new SKPoint(Size.Width - 3, 1), paint3);
e.Canvas.DrawLine(new SKPoint(1, 1), new SKPoint(1, Size.Height - 3), paint3);
e.Canvas.DrawLine(new SKPoint(Size.Width - 2, 1), new SKPoint(Size.Width - 2, Size.Height - 2), paint4);
e.Canvas.DrawLine(new SKPoint(1, Size.Height - 2), new SKPoint(Size.Width - 2, Size.Height - 2), paint4);
e.Canvas.DrawLine(new SKPoint(2, 2), new SKPoint(Size.Width - 4, 2), paint5);
e.Canvas.DrawLine(new SKPoint(2, 2), new SKPoint(2, Size.Height - 4), paint5);
e.Canvas.DrawLine(new SKPoint(Size.Width - 3, 2), new SKPoint(Size.Width - 3, Size.Height - 3), paint5);
e.Canvas.DrawLine(new SKPoint(2, Size.Height - 3), new SKPoint(Size.Width - 3, Size.Height - 3), paint5);
e.Canvas.DrawLine(new SKPoint(3, 3), new SKPoint(Size.Width - 5, 3), paint6);
e.Canvas.DrawLine(new SKPoint(3, 3), new SKPoint(3, Size.Height - 5), paint6);
e.Canvas.DrawLine(new SKPoint(Size.Width - 4, 3), new SKPoint(Size.Width - 4, Size.Height - 4), paint7);
e.Canvas.DrawLine(new SKPoint(3, Size.Height - 4), new SKPoint(Size.Width - 4, Size.Height - 4), paint7);
e.Canvas.DrawLine(new SKPoint(4, 4), new SKPoint(Size.Width - 6, 4), paint6);
e.Canvas.DrawLine(new SKPoint(4, 4), new SKPoint(4, Size.Height - 6), paint6);
e.Canvas.DrawLine(new SKPoint(Size.Width - 5, 4), new SKPoint(Size.Width - 5, Size.Height - 5), paint7);
// Inner border
e.Canvas.DrawLine(new SKPoint(9, 12 - 1), new SKPoint(9 + (Size.Width - 18 - 1), 12 - 1), paint7);
e.Canvas.DrawLine(new SKPoint(10, 12 - 1), new SKPoint(10, Size.Height - 12 - 1), paint7);
e.Canvas.DrawLine(new SKPoint(Size.Width - 11, 12 - 1), new SKPoint(Size.Width - 11, Size.Height - 12 - 1), paint6);
e.Canvas.DrawLine(new SKPoint(9, Size.Height - 12), new SKPoint(Size.Width - 9 - 1, Size.Height - 12), paint6);
e.Canvas.DrawLine(new SKPoint(10, 12 - 2), new SKPoint(9 + (Size.Width - 18 - 2), 12 - 2), paint7);
e.Canvas.DrawLine(new SKPoint(9, 12 - 2), new SKPoint(9, Size.Height - 12), paint7);
e.Canvas.DrawLine(new SKPoint(Size.Width - 10, 12 - 2), new SKPoint(Size.Width - 10, Size.Height - 12), paint6);
e.Canvas.DrawLine(new SKPoint(9, Size.Height - 12 + 1), new SKPoint(Size.Width - 9 - 1, Size.Height - 12+ 1), paint6);
}