|
@@ -22,8 +22,13 @@ namespace NTERA.Console
|
|
|
public delegate void AddedItemEventHandler(IRenderItem item);
|
|
|
public event AddedItemEventHandler AddedItem;
|
|
|
|
|
|
- public ConsoleRenderer()
|
|
|
+ private Brush backgroundBrush = new SolidBrush(Color.Black);
|
|
|
+
|
|
|
+ private Control control;
|
|
|
+
|
|
|
+ public ConsoleRenderer(Control control)
|
|
|
{
|
|
|
+ this.control = control;
|
|
|
Items.Add(new List<IRenderItem>());
|
|
|
LineHeight = (int)(new Font("MS UI Gothic", 12)).GetHeight();
|
|
|
}
|
|
@@ -61,14 +66,21 @@ namespace NTERA.Console
|
|
|
AddedItem?.Invoke(item);
|
|
|
}
|
|
|
|
|
|
+ public void SetBgColor(Color color)
|
|
|
+ {
|
|
|
+ backgroundBrush = new SolidBrush(color);
|
|
|
+ control.Invalidate();
|
|
|
+ }
|
|
|
+
|
|
|
public int Render(Graphics graphics, Rectangle clientArea, Rectangle invalidateArea, Point mousePointer)
|
|
|
{
|
|
|
+ graphics.FillRectangle(backgroundBrush, invalidateArea);
|
|
|
int lastItem = Items.Count - offset;
|
|
|
|
|
|
int screenLineCount = (int)Math.Ceiling(clientArea.Height / (float)LineHeight);
|
|
|
|
|
|
int firstItem = Math.Max(0, lastItem - screenLineCount);
|
|
|
-
|
|
|
+
|
|
|
for (int i = firstItem; i < lastItem; i++)
|
|
|
{
|
|
|
int x = 0;
|