110,533
社区成员
发帖
与我相关
我的任务
分享
internal static void PaintTableCellBorder(TableLayoutPanelCellBorderStyle borderStyle, Graphics g, Rectangle bound)
{
switch (borderStyle)
{
case TableLayoutPanelCellBorderStyle.None:
return;
case TableLayoutPanelCellBorderStyle.Single:
g.DrawRectangle(SystemPens.ControlDark, bound);
return;
case TableLayoutPanelCellBorderStyle.Inset:
using (Pen pen = new Pen(SystemColors.Window))
{
g.DrawLine(pen, bound.X, bound.Y, (bound.X + bound.Width) - 1, bound.Y);
g.DrawLine(pen, bound.X, bound.Y, bound.X, (bound.Y + bound.Height) - 1);
}
g.DrawLine(SystemPens.ControlDark, (bound.X + bound.Width) - 1, bound.Y, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
g.DrawLine(SystemPens.ControlDark, bound.X, (bound.Y + bound.Height) - 1, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
return;
case TableLayoutPanelCellBorderStyle.InsetDouble:
g.DrawRectangle(SystemPens.Control, bound);
bound = new Rectangle(bound.X + 1, bound.Y + 1, bound.Width - 1, bound.Height - 1);
using (Pen pen2 = new Pen(SystemColors.Window))
{
g.DrawLine(pen2, bound.X, bound.Y, (bound.X + bound.Width) - 1, bound.Y);
g.DrawLine(pen2, bound.X, bound.Y, bound.X, (bound.Y + bound.Height) - 1);
}
g.DrawLine(SystemPens.ControlDark, (bound.X + bound.Width) - 1, bound.Y, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
g.DrawLine(SystemPens.ControlDark, bound.X, (bound.Y + bound.Height) - 1, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
return;
case TableLayoutPanelCellBorderStyle.Outset:
{
g.DrawLine(SystemPens.ControlDark, bound.X, bound.Y, (bound.X + bound.Width) - 1, bound.Y);
g.DrawLine(SystemPens.ControlDark, bound.X, bound.Y, bound.X, (bound.Y + bound.Height) - 1);
using (Pen pen3 = new Pen(SystemColors.Window))
{
g.DrawLine(pen3, (bound.X + bound.Width) - 1, bound.Y, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
g.DrawLine(pen3, bound.X, (bound.Y + bound.Height) - 1, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
return;
}
}
case TableLayoutPanelCellBorderStyle.OutsetDouble:
case TableLayoutPanelCellBorderStyle.OutsetPartial:
g.DrawRectangle(SystemPens.Control, bound);
bound = new Rectangle(bound.X + 1, bound.Y + 1, bound.Width - 1, bound.Height - 1);
g.DrawLine(SystemPens.ControlDark, bound.X, bound.Y, (bound.X + bound.Width) - 1, bound.Y);
g.DrawLine(SystemPens.ControlDark, bound.X, bound.Y, bound.X, (bound.Y + bound.Height) - 1);
using (Pen pen4 = new Pen(SystemColors.Window))
{
g.DrawLine(pen4, (bound.X + bound.Width) - 1, bound.Y, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
g.DrawLine(pen4, bound.X, (bound.Y + bound.Height) - 1, (bound.X + bound.Width) - 1, (bound.Y + bound.Height) - 1);
}
return;
default:
return;
}
}