Initialize BorderListBox based upon current DPI

Changed background for border selection
Draw Background and Borders for empty cells
Set the Borders druing Grid conversion
This commit is contained in:
Rich
2011-03-21 16:33:29 +00:00
parent f36d16d84c
commit ec9932d93e
4 changed files with 84 additions and 51 deletions

View File

@@ -198,20 +198,29 @@ namespace Volian.Controls.Library
int w1 = Width - 2 * margin - 1;
int h1 = Height - 2 * margin - 1;
int offset = 4;
DrawBackground(e, x1, y1, x2, y2, w1, h1, w2, h2, offset);
DrawBackground(e, x1, y1, x2, y2, w1, h1, w2, h2, offset, HasRows, HasColumns);
DrawBorder(e, x1, y1, x2, y2);
}
private static void DrawBackground(PaintEventArgs e, int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int offset)
private static void DrawBackground(PaintEventArgs e, int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int offset,bool hasRows, bool hasColumns)
{
e.Graphics.FillRectangle(Brushes.White, x1, y1, w1, h1);
e.Graphics.DrawLine(Pens.LightBlue, x1, offset, x1, y1);
e.Graphics.DrawLine(Pens.LightBlue, x2, offset, x2, y1);
e.Graphics.DrawLine(Pens.LightBlue, x1, y2, x1, h2 - offset);
e.Graphics.DrawLine(Pens.LightBlue, x2, y2, x2, h2 - offset);
e.Graphics.DrawLine(Pens.LightBlue, offset, y1, x1, y1);
e.Graphics.DrawLine(Pens.LightBlue, x2, y1, w2 - offset, y1);
e.Graphics.DrawLine(Pens.LightBlue, offset, y2, x1, y2);
e.Graphics.DrawLine(Pens.LightBlue, x2, y2, w2 - offset, y2);
e.Graphics.FillRectangle(Brushes.White, offset, offset, w2 - 2* offset, h2 - 2* offset);
// Old Backgound - Shows corners
//e.Graphics.DrawLine(Pens.LightBlue, x1, offset, x1, y1);
//e.Graphics.DrawLine(Pens.LightBlue, x2, offset, x2, y1);
//e.Graphics.DrawLine(Pens.LightBlue, x1, y2, x1, h2 - offset);
//e.Graphics.DrawLine(Pens.LightBlue, x2, y2, x2, h2 - offset);
//e.Graphics.DrawLine(Pens.LightBlue, offset, y1, x1, y1);
//e.Graphics.DrawLine(Pens.LightBlue, x2, y1, w2 - offset, y1);
//e.Graphics.DrawLine(Pens.LightBlue, offset, y2, x1, y2);
//e.Graphics.DrawLine(Pens.LightBlue, x2, y2, w2 - offset, y2);
// Horizontal Lines
e.Graphics.DrawLine(Pens.LightBlue, offset, y1, w2 - offset, y1);
if (hasRows) e.Graphics.DrawLine(Pens.LightBlue, x1 + offset, (y1 + y2) / 2, x2 - offset , (y1 + y2) / 2);
e.Graphics.DrawLine(Pens.LightBlue, offset, y2, w2 - offset, y2);
// Vertical Lines
e.Graphics.DrawLine(Pens.LightBlue, x1, offset, x1, h2 - offset);
if (hasColumns) e.Graphics.DrawLine(Pens.LightBlue, (x1 + x2) / 2, y1+offset, (x1 + x2) / 2, y2 - offset);
e.Graphics.DrawLine(Pens.LightBlue, x2, offset, x2, h2 - offset);
}
private void DrawBorder(PaintEventArgs e, int x1, int y1, int x2, int y2)
{