This commit is contained in:
parent
5877037beb
commit
b205558431
@ -102,19 +102,19 @@ namespace Volian.Controls.Library
|
|||||||
CellRange cr = GetMergedRange(r, c);
|
CellRange cr = GetMergedRange(r, c);
|
||||||
if (r == myRange.r1) // Top Border
|
if (r == myRange.r1) // Top Border
|
||||||
if(top != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r1, cr.c1]=top;
|
if(top != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r1, cr.c1]=top;
|
||||||
if (r == myRange.r1 && c == myRange.c1) // Left Border
|
if (c == myRange.c1) // Left Border
|
||||||
if(left != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r1, cr.c1]=left;
|
if(left != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r1, cr.c1]=left;
|
||||||
if (r == myRange.r2) // Bottom Border
|
if (r == myRange.r2) // Bottom Border
|
||||||
if(bottom != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=bottom;
|
if(bottom != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=bottom;
|
||||||
if (r == myRange.r2 && c == myRange.c2) // Right Border
|
if (c == myRange.c2) // Right Border
|
||||||
if(right != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1] = right;
|
if(right != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1] = right;
|
||||||
if (r == cr.r1 && c == cr.c1) // Look for inside lines
|
if (r == cr.r1 && c == cr.c1) // Look for inside lines
|
||||||
{
|
{
|
||||||
if (cr.r1 > myRange.r1 && cr.r1 < myRange.r2) // Inside Horizontal Top
|
if (cr.r1 > myRange.r1 && cr.r1 <= myRange.r2) // Inside Horizontal Top
|
||||||
if(middle != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r1, cr.c1]=middle;
|
if(middle != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r1, cr.c1]=middle;
|
||||||
if (cr.r2 > myRange.r1 && cr.r2 < myRange.r2) // Inside Horizontal Bottom
|
if (cr.r2 > myRange.r1 && cr.r2 < myRange.r2) // Inside Horizontal Bottom
|
||||||
if(middle != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=middle;
|
if(middle != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=middle;
|
||||||
if (cr.c1 > myRange.c1 && cr.c1 < myRange.c2) // Inside Vertical Left
|
if (cr.c1 > myRange.c1 && cr.c1 <= myRange.c2) // Inside Vertical Left
|
||||||
if(center != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r1, cr.c1]=center;
|
if(center != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r1, cr.c1]=center;
|
||||||
if (cr.c2 > myRange.c1 && cr.c2 < myRange.c2) // Inside Vertical Right
|
if (cr.c2 > myRange.c1 && cr.c2 < myRange.c2) // Inside Vertical Right
|
||||||
if(center != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1]=center;
|
if(center != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1]=center;
|
||||||
@ -768,49 +768,106 @@ namespace Volian.Controls.Library
|
|||||||
GridLinePattern lineLeft = MyBorders.VerticalLines[cr.r1, cr.c1];
|
GridLinePattern lineLeft = MyBorders.VerticalLines[cr.r1, cr.c1];
|
||||||
GridLinePattern lineBottom = MyBorders.HorizontalLines[cr.r2+1, cr.c2];
|
GridLinePattern lineBottom = MyBorders.HorizontalLines[cr.r2+1, cr.c2];
|
||||||
GridLinePattern lineRight = MyBorders.VerticalLines[cr.r2, cr.c2+1];
|
GridLinePattern lineRight = MyBorders.VerticalLines[cr.r2, cr.c2+1];
|
||||||
GridLinePattern lineTopLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c1 - 1];
|
|
||||||
GridLinePattern lineTopRight = cr.c2 == Cols.Count -1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c2+1];
|
|
||||||
GridLinePattern lineLeftAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c1];
|
|
||||||
GridLinePattern lineLeftBelow = cr.r2 == Rows.Count -1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 +1, cr.c1];
|
|
||||||
GridLinePattern lineBottomLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c1 - 1];
|
|
||||||
GridLinePattern lineBottomRight = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2+1, cr.c2+1];
|
|
||||||
GridLinePattern lineRightAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c2];
|
|
||||||
GridLinePattern lineRightBelow = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c2];
|
|
||||||
int x1 = bounds.Left;
|
int x1 = bounds.Left;
|
||||||
int y1 = bounds.Top;
|
int y1 = bounds.Top;
|
||||||
int x2 = bounds.Right - 1;
|
int x2 = bounds.Right - 1;
|
||||||
int y2 = bounds.Bottom - 1;
|
int y2 = bounds.Bottom - 1;
|
||||||
Color bColor = Color.Blue;
|
Console.WriteLine("{0},{1},{2},{3},{4},{5},{6}", e.Row, e.Col, (e.Style ?? Styles.Normal).Name, lineTop, lineLeft, lineBottom, lineRight);
|
||||||
|
Color bColor = Color.Blue; // Temporary - Set the border color to blue.
|
||||||
if (row == 0 && lineTop != GridLinePattern.None)
|
if (row == 0 && lineTop != GridLinePattern.None)
|
||||||
{
|
{
|
||||||
|
Pen pn = VlnBorders.LinePen(lineTop, bColor);
|
||||||
|
GridLinePattern lineTopLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c1 - 1];
|
||||||
|
GridLinePattern lineTopRight = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r1, cr.c2 + 1];
|
||||||
|
int dxTop = col == 0 ? (lineLeft == GridLinePattern.Double ? -3 :-1): 0;
|
||||||
int dx = col == 0 ? -1 : 0;
|
int dx = col == 0 ? -1 : 0;
|
||||||
GridItem myGridItem = Parent as GridItem;
|
GridItem myGridItem = Parent as GridItem;
|
||||||
using (Graphics grParent = myGridItem.CreateGraphics())
|
using (Graphics grParent = myGridItem.CreateGraphics())
|
||||||
{
|
{
|
||||||
grParent.DrawLine(VlnBorders.LinePen(lineTop, bColor), x1 + Left + dx, y1 + Top - 1, x2 + Left, y1 + Top - 1);
|
|
||||||
if (lineTop == GridLinePattern.Double)// cr.r2 == 0)
|
if (lineTop == GridLinePattern.Double)// cr.r2 == 0)
|
||||||
grParent.DrawLine(VlnBorders.LinePen(lineTop, bColor), x1 + Left + 3*dx, y1 + Top - 3, x2 + Left, y1 + Top - 3);
|
{
|
||||||
|
int lengthAdjustBottom = lineRight == GridLinePattern.Double ? -2 : 0;
|
||||||
|
grParent.DrawLine(pn, x1 + Left + dxTop, y1 + Top - 3, x2 + Left, y1 + Top - 3);
|
||||||
|
grParent.DrawLine(pn, x1 + Left + dx, y1 + Top - 1, x2 + Left + lengthAdjustBottom, y1 + Top - 1);
|
||||||
|
//if (lineRight == GridLinePattern.Double && lineTopRight != GridLinePattern.Double)
|
||||||
|
if (lineRight != GridLinePattern.None && lineTopRight != GridLinePattern.Double)
|
||||||
|
grParent.DrawLine(VlnBorders.LinePen(lineRight,bColor), x2 + Left, y1 + Top - 3, x2 + Left, y1 + Top - 1);
|
||||||
|
}
|
||||||
|
else if(pn.Width < 2)
|
||||||
|
grParent.DrawLine(pn, x1 + Left + dxTop, y1 + Top - 1, x2 + Left, y1 + Top - 1);
|
||||||
|
else // Move line up and draw an extra pixel long to account for a bug in graphics
|
||||||
|
grParent.DrawLine(pn, x1 + Left + dxTop, y1 + Top - 2, x2 + Left + 1, y1 + Top - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (col == 0 && lineLeft != GridLinePattern.None)
|
if (col == 0 && lineLeft != GridLinePattern.None)
|
||||||
{
|
{
|
||||||
|
Pen pn = VlnBorders.LinePen(lineLeft, bColor);
|
||||||
|
GridLinePattern lineLeftAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c1];
|
||||||
|
GridLinePattern lineLeftBelow = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c1];
|
||||||
|
int dyLeft = row == 0 ? (lineTop == GridLinePattern.Double ? -3:-1) : 0;
|
||||||
int dy = row == 0 ? -1 : 0;
|
int dy = row == 0 ? -1 : 0;
|
||||||
GridItem myGridItem = Parent as GridItem;
|
GridItem myGridItem = Parent as GridItem;
|
||||||
using (Graphics grParent = myGridItem.CreateGraphics())
|
using (Graphics grParent = myGridItem.CreateGraphics())
|
||||||
{
|
{
|
||||||
grParent.DrawLine(VlnBorders.LinePen(lineLeft, bColor), x1 + Left - 1, y1 + Top + dy, x1 + Left - 1, y2 + Top);
|
|
||||||
if (lineLeft == GridLinePattern.Double)// cr.r2 == 0)
|
if (lineLeft == GridLinePattern.Double)// cr.r2 == 0)
|
||||||
grParent.DrawLine(VlnBorders.LinePen(lineLeft, bColor), x1 + Left - 3, y1 + Top + 3*dy, x1 + Left - 3, y2 + Top);
|
{
|
||||||
|
int lengthAdjustRight = lineBottom == GridLinePattern.Double ? -2 : 0;
|
||||||
|
grParent.DrawLine(pn, x1 + Left - 3, y1 + Top + dyLeft, x1 + Left - 3, y2 + Top);
|
||||||
|
grParent.DrawLine(pn, x1 + Left - 1, y1 + Top + dy, x1 + Left - 1, y2 + Top + lengthAdjustRight);
|
||||||
|
if (lineBottom != GridLinePattern.None && lineLeftBelow != GridLinePattern.Double)
|
||||||
|
grParent.DrawLine(VlnBorders.LinePen(lineBottom, bColor), x1 + Left - 3, y2 + Top, x1 + Left - 1, y2 + Top);
|
||||||
|
}
|
||||||
|
else if (pn.Width < 2)
|
||||||
|
grParent.DrawLine(pn, x1 + Left - 1, y1 + Top + dyLeft, x1 + Left - 1, y2 + Top);
|
||||||
|
else // Move line left and draw an extra pixel long to account for a bug in graphics
|
||||||
|
grParent.DrawLine(pn, x1 + Left - 2, y1 + Top + dyLeft, x1 + Left - 2, y2 + Top + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lineBottom != GridLinePattern.None) graphics.DrawLine(VlnBorders.LinePen(lineBottom, bColor), x1, y2, x2, y2);
|
GridLinePattern lineBottomLeft = cr.c1 == 0 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c1 - 1];
|
||||||
if (lineRight != GridLinePattern.None) graphics.DrawLine(VlnBorders.LinePen(lineRight, bColor), x2, y1, x2, y2);
|
GridLinePattern lineBottomRight = cr.c2 == Cols.Count - 1 ? GridLinePattern.None : MyBorders.HorizontalLines[cr.r2 + 1, cr.c2 + 1];
|
||||||
// Double line attribute the Bottom of the first row
|
GridLinePattern lineRightAbove = cr.r1 == 0 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r1 - 1, cr.c2 + 1];
|
||||||
if (lineBottom == GridLinePattern.Double)// cr.r2 == 0)
|
GridLinePattern lineRightBelow = cr.r2 == Rows.Count - 1 ? GridLinePattern.None : MyBorders.VerticalLines[cr.r2 + 1, cr.c2 + 1];
|
||||||
graphics.DrawLine(VlnBorders.LinePen(lineBottom, bColor), x1, y2 - 2, x2, y2 - 2);
|
if (lineBottom != GridLinePattern.None)
|
||||||
if (lineRight == GridLinePattern.Double)// cr.r2 == 0)
|
{
|
||||||
graphics.DrawLine(VlnBorders.LinePen(lineRight, bColor), x2-2, y1, x2-2, y2);
|
Pen pn = VlnBorders.LinePen(lineBottom, bColor);
|
||||||
|
int rightWidth = lineRight == GridLinePattern.Double ? 3 : 0; //VlnBorders.LineWidth(lineRight);
|
||||||
|
int thickAdjust = 0;
|
||||||
|
if (lineBottom == GridLinePattern.Thick && lineRight == GridLinePattern.Double && lineBottomRight != GridLinePattern.Thick)
|
||||||
|
thickAdjust = -3;
|
||||||
|
if (lineBottom == GridLinePattern.Double)
|
||||||
|
{
|
||||||
|
int lengthAdjustTop = lineRight == GridLinePattern.Double ? -2 : 0;
|
||||||
|
int lengthAdjustBottom = lineRightBelow == GridLinePattern.Double ? -2 : 0;
|
||||||
|
graphics.DrawLine(pn, x1, y2 - 2, x2+lengthAdjustTop, y2 - 2);
|
||||||
|
graphics.DrawLine(pn, x1, y2, x2+lengthAdjustBottom, y2);
|
||||||
|
if (lineRight == GridLinePattern.Double && lineBottomRight == GridLinePattern.Double && lineRightBelow == GridLinePattern.Double)
|
||||||
|
graphics.DrawLine(pn, x2, y2, x2+1, y2);
|
||||||
|
}
|
||||||
|
else if(pn.Width < 2) // Bottom line is thin. Determine if intersecting with double:
|
||||||
|
graphics.DrawLine(pn, x1, y2, x2-rightWidth, y2);
|
||||||
|
else // Move line up and draw an extra pixel long to account for a bug in graphics
|
||||||
|
graphics.DrawLine(pn, x1, y2 - 1, x2 + 1 + thickAdjust, y2 - 1);
|
||||||
|
}
|
||||||
|
if (lineRight != GridLinePattern.None)
|
||||||
|
{
|
||||||
|
Pen pn = VlnBorders.LinePen(lineRight, bColor);
|
||||||
|
int bottomWidth = lineBottom == GridLinePattern.Double ? 3 : 0;//VlnBorders.LineWidth(lineBottom);
|
||||||
|
|
||||||
|
int thickAdjust = 0;
|
||||||
|
if (lineRight == GridLinePattern.Thick && lineBottom == GridLinePattern.Double && lineRightBelow != GridLinePattern.Thick)
|
||||||
|
thickAdjust = -3;
|
||||||
|
if (lineRight == GridLinePattern.Double)// cr.r2 == 0)
|
||||||
|
{
|
||||||
|
int lengthAdjustLeft = lineBottom == GridLinePattern.Double ? -2 : 0;
|
||||||
|
int lengthAdjustRight = lineBottomRight == GridLinePattern.Double ? -2 : 0;
|
||||||
|
graphics.DrawLine(pn, x2 - 2, y1, x2 - 2, y2+lengthAdjustLeft);
|
||||||
|
graphics.DrawLine(pn, x2, y1, x2, y2+lengthAdjustRight);
|
||||||
|
}
|
||||||
|
else if (pn.Width < 2)
|
||||||
|
graphics.DrawLine(pn, x2, y1, x2, y2-bottomWidth);
|
||||||
|
else
|
||||||
|
graphics.DrawLine(pn, x2 - 1, y1, x2 - 1, y2 + 1 + thickAdjust);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion //Grid Initialize
|
#endregion //Grid Initialize
|
||||||
#region Grid and Cell Styles
|
#region Grid and Cell Styles
|
||||||
|
Loading…
x
Reference in New Issue
Block a user