BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
public static void Draw3dFrame(Graphics g, int x0, int y0, int x1, int y1, int w, Color rgbTopLeft, Color rgbBottomRight)
{
Rectangle rc;
for (int i = 0; i != w; i++)
{
// Top
Brush brTL = new SolidBrush(rgbTopLeft);
rc = Rectangle.FromLTRB(x0, y0, x1, y0+1);
g.FillRectangle(brTL, rc);
// Left
rc = Rectangle.FromLTRB(x0, y0, x0+1, y1);
g.FillRectangle(brTL, rc);
brTL.Dispose();
Brush brBR = new SolidBrush(rgbBottomRight);
// Bottom
rc = Rectangle.FromLTRB(x0, y1, x1+1, y1+1);
g.FillRectangle(brBR, rc);
// Right
rc = Rectangle.FromLTRB(x1, y0, x1+1, y1);
g.FillRectangle(brBR, rc);
brBR.Dispose();
if (i != w-1)
{
x0++;
y0++;
x1--;
y1--;
}
}
}
protected override void OnDrawCellButtonBackground(GridDrawCellButtonBackgroundEventArgs e)
{
bool drawPressed = (e.ButtonState & ButtonState.Pushed) != 0;
Rectangle rect = e.Bounds;
Graphics g = e.Graphics;
Color hilight = SystemColors.ControlLightLight;
Color shadow = SystemColors.ControlDarkDark;
if (!drawPressed)
{
Draw3dFrame(e.Graphics, rect.Left, rect.Top, rect.Right-1, rect.Bottom-1, 1,
hilight, shadow);
}
else
{
Brush br = new SolidBrush(shadow);
g.FillRectangle(br, Rectangle.FromLTRB(rect.Left, rect.Bottom-1, rect.Right-1, rect.Bottom));
g.FillRectangle(br, Rectangle.FromLTRB(rect.Right-1, rect.Top, rect.Right, rect.Bottom));
br.Dispose();
}
e.Cancel = true;
}
Stefan