private void DrawSurface(IGraphics g, bool onScreen, Style style)
{
// Update graphical objects
backgroundBrush.Color = style.CommentBackColor;
borderPen.Color = style.CommentBorderColor;
borderPen.Width = style.CommentBorderWidth;
if (style.IsCommentBorderDashed)
borderPen.DashPattern = borderDashPattern;
else
borderPen.DashStyle = DashStyle.Solid;
// Create shape pattern
GraphicsPath path = new GraphicsPath();
path.AddLine(Left, Top, Right - PaddingSize, Top);
path.AddLine(Right, Top + PaddingSize, Right, Bottom);
path.AddLine(Right, Bottom, Left, Bottom);
path.CloseFigure();
// Draw shadow first
if ((!onScreen || !IsSelected) && !style.ShadowOffset.IsEmpty)
{
shadowBrush.Color = style.ShadowColor;
g.TranslateTransform(style.ShadowOffset.Width, style.ShadowOffset.Height);
g.FillPath(shadowBrush, path);
g.TranslateTransform(-style.ShadowOffset.Width, -style.ShadowOffset.Height);
}
// Draw borders & background
g.FillPath(backgroundBrush, path);
g.DrawPath(borderPen, path);
// Draw earmark
path.Reset();
path.AddLine(Right - PaddingSize, Top, Right - PaddingSize, Top + PaddingSize);
path.AddLine(Right - PaddingSize, Top + PaddingSize, Right, Top + PaddingSize);
g.DrawPath(borderPen, path);
path.Dispose();
}