2017-02-26 19:23:31 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2020-12-20 07:42:04 +00:00
|
|
|
|
namespace DisplayMagicianShared.UserControls
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
|
|
|
|
public partial class DisplayView : UserControl
|
|
|
|
|
{
|
2020-06-07 08:48:45 +00:00
|
|
|
|
private ProfileItem _profile;
|
2017-02-26 19:23:31 +00:00
|
|
|
|
|
|
|
|
|
public DisplayView()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
ResizeRedraw = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int PaddingX { get; set; } = 100;
|
|
|
|
|
public int PaddingY { get; set; } = 100;
|
|
|
|
|
|
2020-06-07 08:48:45 +00:00
|
|
|
|
public ProfileItem Profile
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
2018-10-20 00:27:25 +00:00
|
|
|
|
get => _profile;
|
2017-02-26 19:23:31 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_profile = value;
|
|
|
|
|
Invalidate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnPaint(e);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
if (_profile != null)
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2017-02-26 19:23:31 +00:00
|
|
|
|
DrawView(e.Graphics);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
}
|
2020-12-10 09:56:20 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DrawEmptyView(e.Graphics);
|
|
|
|
|
}
|
2017-02-26 19:23:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-06-26 09:54:11 +00:00
|
|
|
|
/*private void DrawScreen(Graphics g, ScreenPosition screen)
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
2021-06-24 10:14:39 +00:00
|
|
|
|
//var res = ProfileIcon.NormalizeResolution(screens);
|
|
|
|
|
var rect = new Rectangle(screen.ScreenX, screen.ScreenY, screen.ScreenWidth, screen.ScreenHeight);
|
2017-02-26 19:23:31 +00:00
|
|
|
|
g.FillRectangle(new SolidBrush(Color.FromArgb(15, Color.White)), rect);
|
|
|
|
|
g.DrawRectangle(Pens.Black, rect);
|
|
|
|
|
|
2021-06-26 09:54:11 +00:00
|
|
|
|
*//*DrawString(g, path.Position.IsEmpty ? "[Primary]" : $"[{path.Position.X}, {path.Position.Y}]", rect.Size,
|
|
|
|
|
new PointF(rect.X + PaddingY / 2, rect.Y + PaddingY / 2), StringAlignment.Near, StringAlignment.Near);*//*
|
2017-02-26 19:23:31 +00:00
|
|
|
|
|
2021-06-25 09:52:02 +00:00
|
|
|
|
var str = $"DISPLAY {screen.Name}{Environment.NewLine}{rect.Width}×{rect.Height}";
|
2018-10-20 00:27:25 +00:00
|
|
|
|
var strSize = DrawString(g, str, rect.Size, new PointF(rect.X - PaddingX / 2, rect.Y + PaddingY / 2),
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Near, StringAlignment.Far);
|
|
|
|
|
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2021-06-26 09:54:11 +00:00
|
|
|
|
var rows = rect.Width < rect.Height ? screen.Count : 1;
|
|
|
|
|
var cols = rect.Width >= rect.Height ? screen.Count : 1;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < screen.Count; i++)
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2021-06-25 09:52:02 +00:00
|
|
|
|
DrawTarget(g, screen,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new Rectangle(rect.X + PaddingX, rect.Y + strSize.Height + PaddingY, rect.Width - 2 * PaddingX,
|
|
|
|
|
rect.Height - strSize.Height - 2 * PaddingY),
|
2017-02-26 19:23:31 +00:00
|
|
|
|
rows > 1 ? i : 0, cols > 1 ? i : 0, rows, cols);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
}
|
2021-06-26 09:54:11 +00:00
|
|
|
|
}*/
|
2017-02-26 19:23:31 +00:00
|
|
|
|
|
2018-10-20 00:27:25 +00:00
|
|
|
|
private Size DrawString(
|
|
|
|
|
Graphics g,
|
|
|
|
|
string str,
|
2021-06-26 09:54:11 +00:00
|
|
|
|
Color colour,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
SizeF drawingSize = default(SizeF),
|
|
|
|
|
PointF? drawingPoint = null,
|
|
|
|
|
StringAlignment vertical = StringAlignment.Center,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment horizontal = StringAlignment.Center)
|
|
|
|
|
{
|
|
|
|
|
var format = new StringFormat(StringFormat.GenericTypographic)
|
|
|
|
|
{
|
|
|
|
|
Alignment = horizontal,
|
|
|
|
|
LineAlignment = vertical,
|
2021-06-26 09:54:11 +00:00
|
|
|
|
FormatFlags = StringFormatFlags.NoClip
|
2017-02-26 19:23:31 +00:00
|
|
|
|
};
|
|
|
|
|
var stringSize = g.MeasureString(str, Font, drawingSize, format);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
if (drawingPoint != null)
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2021-06-26 09:54:11 +00:00
|
|
|
|
g.DrawString(str, Font, new SolidBrush(colour), new RectangleF(drawingPoint.Value, drawingSize),
|
2017-02-26 19:23:31 +00:00
|
|
|
|
format);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
return new Size((int) stringSize.Width, (int) stringSize.Height);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-25 09:52:02 +00:00
|
|
|
|
public virtual void DrawSpannedTopology(Graphics g, ScreenPosition screen, Rectangle rect)
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
|
|
|
|
g.DrawRectangle(Pens.Black, rect);
|
|
|
|
|
|
2021-06-25 09:52:02 +00:00
|
|
|
|
var targetSize = new Size(rect.Width / screen.SpannedColumns,
|
|
|
|
|
rect.Height / screen.SpannedRows);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2021-06-25 09:52:02 +00:00
|
|
|
|
for (var i = 0; i < screen.SpannedScreens.Count; i++)
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
2021-06-25 09:52:02 +00:00
|
|
|
|
var display = screen.SpannedScreens[i];
|
|
|
|
|
var row = i / screen.SpannedColumns;
|
|
|
|
|
var col = i % screen.SpannedColumns;
|
2018-10-20 00:27:25 +00:00
|
|
|
|
var targetPosition = new Point(targetSize.Width * col + rect.X, targetSize.Height * row + rect.Y);
|
2017-02-26 19:23:31 +00:00
|
|
|
|
var targetRect = new Rectangle(targetPosition, targetSize);
|
|
|
|
|
|
|
|
|
|
g.DrawRectangle(Pens.Black, targetRect);
|
|
|
|
|
|
2021-06-25 09:52:02 +00:00
|
|
|
|
/*switch (display.Rotation)
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
|
|
|
|
case Rotation.Rotate90:
|
|
|
|
|
DrawString(g, "90°", targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X - PaddingX / 2, targetRect.Y + PaddingY / 2), StringAlignment.Near,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Far);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
break;
|
|
|
|
|
case Rotation.Rotate180:
|
|
|
|
|
DrawString(g, "180°", targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X - PaddingX / 2, targetRect.Y + PaddingY / 2), StringAlignment.Near,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Far);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
break;
|
|
|
|
|
case Rotation.Rotate270:
|
|
|
|
|
DrawString(g, "270°", targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X - PaddingX / 2, targetRect.Y + PaddingY / 2), StringAlignment.Near,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Far);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
break;
|
2021-06-25 09:52:02 +00:00
|
|
|
|
}*/
|
2017-02-26 19:23:31 +00:00
|
|
|
|
|
2021-06-25 09:52:02 +00:00
|
|
|
|
/*if (!display.Overlap.IsEmpty)
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2017-02-26 19:23:31 +00:00
|
|
|
|
DrawString(g, $"[{-display.Overlap.X}, {-display.Overlap.Y}]", targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X + PaddingY / 2, targetRect.Y + PaddingY / 2), StringAlignment.Near,
|
2017-08-10 14:21:45 +00:00
|
|
|
|
StringAlignment.Near);
|
2021-06-25 09:52:02 +00:00
|
|
|
|
}*/
|
2017-02-26 19:23:31 +00:00
|
|
|
|
|
|
|
|
|
// Invert to real monitor resolution
|
2021-06-25 09:52:02 +00:00
|
|
|
|
//var res = ProfileIcon.NormalizeResolution(target.SurroundTopology.Resolution, display.Rotation);
|
|
|
|
|
/*var str = $"{display.DisplayName}{Environment.NewLine}{res.Width}×{res.Height}";
|
|
|
|
|
DrawString(g, str, targetRect.Size, targetRect.Location);*/
|
2017-02-26 19:23:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-22 09:45:51 +00:00
|
|
|
|
/* private void DrawTarget(
|
2018-10-20 00:27:25 +00:00
|
|
|
|
Graphics g,
|
2021-06-25 09:52:02 +00:00
|
|
|
|
ScreenPosition screen,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
Rectangle rect,
|
|
|
|
|
int row,
|
|
|
|
|
int col,
|
|
|
|
|
int rows,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
int cols)
|
|
|
|
|
{
|
2018-10-20 00:27:25 +00:00
|
|
|
|
var targetSize = new Size(rect.Width / cols, rect.Height / rows);
|
|
|
|
|
var targetPosition = new Point(targetSize.Width * col + rect.X, targetSize.Height * row + rect.Y);
|
2017-02-26 19:23:31 +00:00
|
|
|
|
var targetRect = new Rectangle(targetPosition, targetSize);
|
|
|
|
|
|
2021-06-25 09:52:02 +00:00
|
|
|
|
if (screen.IsSpanned)
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2017-02-26 19:23:31 +00:00
|
|
|
|
g.FillRectangle(new SolidBrush(Color.FromArgb(150, 106, 185, 0)), targetRect);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
}
|
2017-02-26 19:23:31 +00:00
|
|
|
|
//else if (target.EyefinityTopology != null)
|
|
|
|
|
// g.FillRectangle(new SolidBrush(Color.FromArgb(150, 99, 0, 0)), targetRect);
|
2021-06-25 09:52:02 +00:00
|
|
|
|
else if (screen.SpannedScreens.Count > 1)
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2017-02-26 19:23:31 +00:00
|
|
|
|
g.FillRectangle(new SolidBrush(Color.FromArgb(150, 255, 97, 27)), targetRect);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
}
|
2021-06-25 09:52:02 +00:00
|
|
|
|
else if (!screen.IsSpanned)
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2017-02-26 19:23:31 +00:00
|
|
|
|
g.FillRectangle(new SolidBrush(Color.FromArgb(150, 0, 174, 241)), targetRect);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
}
|
2017-02-26 19:23:31 +00:00
|
|
|
|
else
|
2018-10-20 00:27:25 +00:00
|
|
|
|
{
|
2017-02-26 19:23:31 +00:00
|
|
|
|
g.FillRectangle(new SolidBrush(Color.FromArgb(255, 155, 155, 155)), targetRect);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
}
|
2017-02-26 19:23:31 +00:00
|
|
|
|
|
|
|
|
|
g.DrawRectangle(Pens.Black, targetRect);
|
2021-06-25 09:52:02 +00:00
|
|
|
|
var str = $"{screen.Name}{Environment.NewLine}{screen.ScreenWidth}×{screen.ScreenHeight}";
|
2021-08-22 09:45:51 +00:00
|
|
|
|
*/
|
2021-06-25 09:52:02 +00:00
|
|
|
|
/* switch (target.Rotation)
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
|
|
|
|
case Rotation.Rotate90:
|
|
|
|
|
DrawString(g, "90°", targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X - PaddingX / 2, targetRect.Y + PaddingY / 2), StringAlignment.Near,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Far);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
break;
|
|
|
|
|
case Rotation.Rotate180:
|
|
|
|
|
DrawString(g, "180°", targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X - PaddingX / 2, targetRect.Y + PaddingY / 2), StringAlignment.Near,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Far);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
break;
|
|
|
|
|
case Rotation.Rotate270:
|
|
|
|
|
DrawString(g, "270°", targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X - PaddingX / 2, targetRect.Y + PaddingY / 2), StringAlignment.Near,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Far);
|
2018-10-20 00:27:25 +00:00
|
|
|
|
|
2017-02-26 19:23:31 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2021-06-26 09:54:11 +00:00
|
|
|
|
*//*
|
2021-06-25 09:52:02 +00:00
|
|
|
|
if (screen.IsSpanned)
|
2017-02-26 19:23:31 +00:00
|
|
|
|
{
|
|
|
|
|
var strSize = DrawString(g, str, targetRect.Size,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
new PointF(targetRect.X + PaddingX / 2, targetRect.Y + PaddingY / 2),
|
2017-02-26 19:23:31 +00:00
|
|
|
|
StringAlignment.Near, StringAlignment.Near);
|
2021-06-25 09:52:02 +00:00
|
|
|
|
DrawSpannedTopology(g, screen,
|
2017-02-26 19:23:31 +00:00
|
|
|
|
new Rectangle(
|
|
|
|
|
targetRect.X + PaddingX,
|
|
|
|
|
targetRect.Y + strSize.Height + PaddingY,
|
2018-10-20 00:27:25 +00:00
|
|
|
|
targetRect.Width - 2 * PaddingX,
|
|
|
|
|
targetRect.Height - strSize.Height - 2 * PaddingY));
|
2017-02-26 19:23:31 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DrawString(g, str, targetRect.Size, targetRect.Location);
|
2021-06-26 09:54:11 +00:00
|
|
|
|
}*/
|
2021-08-22 09:45:51 +00:00
|
|
|
|
//}
|
2017-02-26 19:23:31 +00:00
|
|
|
|
|
2021-06-26 09:54:11 +00:00
|
|
|
|
|
|
|
|
|
private void DrawView(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
var viewSize = ProfileIcon.CalculateViewSize(_profile.Screens, PaddingX, PaddingY);
|
|
|
|
|
var factor = Math.Min(Width / viewSize.Width, Height / viewSize.Height);
|
|
|
|
|
g.ScaleTransform(factor, factor);
|
|
|
|
|
|
|
|
|
|
var xOffset = (Width / factor - viewSize.Width) / 2f;
|
|
|
|
|
var yOffset = (Height / factor - viewSize.Height) / 2f;
|
|
|
|
|
g.TranslateTransform(-viewSize.X + xOffset, -viewSize.Y + yOffset);
|
|
|
|
|
|
|
|
|
|
// How wide the Bezel is on the screen graphics
|
|
|
|
|
int screenBezel = 60;
|
|
|
|
|
int screenWordBuffer = 30;
|
|
|
|
|
|
|
|
|
|
foreach (ScreenPosition screen in _profile.Screens)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Color screenBgColour;
|
|
|
|
|
Color lightTextColour = Color.White;
|
|
|
|
|
Color darkTextColour = Color.Black;
|
|
|
|
|
|
|
|
|
|
// draw the screen
|
|
|
|
|
if (screen.IsSpanned)
|
|
|
|
|
{
|
|
|
|
|
//g.FillRectangle(new SolidBrush(Color.FromArgb(150, 106, 185, 0)), targetRect);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-06-29 10:15:57 +00:00
|
|
|
|
// We do these things only if the screen isn't spanned!
|
2021-06-26 09:54:11 +00:00
|
|
|
|
// Draw the outline of the monitor
|
|
|
|
|
Rectangle outlineRect = new Rectangle(screen.ScreenX, screen.ScreenY, screen.ScreenWidth, screen.ScreenHeight);
|
|
|
|
|
g.FillRectangle(new SolidBrush(Color.FromArgb(255, 33, 33, 33)), outlineRect);
|
|
|
|
|
g.DrawRectangle(Pens.Black, outlineRect);
|
|
|
|
|
|
|
|
|
|
// Draw the screen of the monitor
|
|
|
|
|
Rectangle screenRect = new Rectangle(screen.ScreenX + screenBezel, screen.ScreenY + screenBezel, screen.ScreenWidth - (screenBezel * 2), screen.ScreenHeight - (screenBezel * 2));
|
2021-06-29 10:15:57 +00:00
|
|
|
|
if (screen.IsPrimary)
|
2021-06-26 09:54:11 +00:00
|
|
|
|
{
|
2021-06-29 10:15:57 +00:00
|
|
|
|
//screenBgColour = Color.FromArgb(255, 66, 173, 245);
|
|
|
|
|
screenBgColour = Color.FromArgb(240, 116, 215, 255);
|
2021-06-26 09:54:11 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-06-29 10:15:57 +00:00
|
|
|
|
if (screen.Colour != null)
|
|
|
|
|
{
|
|
|
|
|
screenBgColour = screen.Colour;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-08-22 09:45:51 +00:00
|
|
|
|
screenBgColour = Color.FromArgb(255, 195, 195, 195);
|
2021-06-29 10:15:57 +00:00
|
|
|
|
}
|
2021-06-26 09:54:11 +00:00
|
|
|
|
}
|
2021-06-29 10:15:57 +00:00
|
|
|
|
|
2021-06-26 09:54:11 +00:00
|
|
|
|
g.FillRectangle(new SolidBrush(screenBgColour), screenRect);
|
|
|
|
|
g.DrawRectangle(Pens.Black, screenRect);
|
|
|
|
|
|
|
|
|
|
Rectangle wordRect = new Rectangle(screen.ScreenX + screenBezel + screenWordBuffer, screen.ScreenY + screenBezel + screenWordBuffer, screen.ScreenWidth - (screenBezel * 2) - (screenWordBuffer * 2), screen.ScreenHeight - (screenBezel * 2) - (screenWordBuffer * 2));
|
|
|
|
|
Color wordTextColour = pickTextColorBasedOnBgColour(screenBgColour, lightTextColour, darkTextColour);
|
|
|
|
|
// Draw the name of the screen and the size of it
|
2021-06-29 10:15:57 +00:00
|
|
|
|
string str = $"{screen.Name}{Environment.NewLine}{screen.ScreenWidth}×{screen.ScreenHeight}{Environment.NewLine}{screen.DisplayConnector}";
|
|
|
|
|
if (screen.IsPrimary)
|
|
|
|
|
{
|
|
|
|
|
str = $"Primary Display{Environment.NewLine}" + str;
|
|
|
|
|
}
|
2021-06-26 09:54:11 +00:00
|
|
|
|
DrawString(g, str, wordTextColour, wordRect.Size, wordRect.Location);
|
|
|
|
|
|
|
|
|
|
// Draw the position of the screen
|
|
|
|
|
str = $"[{screen.ScreenX},{screen.ScreenY}]";
|
|
|
|
|
DrawString(g, str, wordTextColour, wordRect.Size, wordRect.Location, StringAlignment.Near, StringAlignment.Near);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Color pickTextColorBasedOnBgColour(Color bgColour, Color lightColour, Color darkColour)
|
|
|
|
|
{
|
|
|
|
|
if ((bgColour.R * 0.299 + bgColour.G * 0.587 + bgColour.B * 0.114) > 186)
|
|
|
|
|
{
|
|
|
|
|
return darkColour;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return lightColour;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Bitmap pickBitmapBasedOnBgColour(Color bgColour, Bitmap lightBitmap, Bitmap darkBitmap)
|
|
|
|
|
{
|
|
|
|
|
if ((bgColour.R * 0.299 + bgColour.G * 0.587 + bgColour.B * 0.114) > 186)
|
|
|
|
|
{
|
|
|
|
|
return darkBitmap;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return lightBitmap;
|
|
|
|
|
}
|
2017-02-26 19:23:31 +00:00
|
|
|
|
}
|
2020-12-10 09:56:20 +00:00
|
|
|
|
|
|
|
|
|
private void DrawEmptyView(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
RectangleF rect = g.VisibleClipBounds;
|
|
|
|
|
g.FillRectangle(new SolidBrush(Color.FromArgb(15, Color.White)), rect);
|
|
|
|
|
g.DrawRectangle(Pens.Black, rect.X, rect.Y, rect.Width, rect.Height);
|
|
|
|
|
}
|
2017-02-26 19:23:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|