OnRenderToolStripBackground...
Hi,
I have a ToolStripDropDown button in a toolstrip. I am trying to draw rounded corners for the ToolStripDropDown button and ToolStripDropDown menu using ToolStripProfessionalrenderer...
I am able to get the rounded corners..but a flat rectangle is always beneath the dropdown menu...i am trying to override the ToolStripBackground event to avoid drawing that base rectangle..
protectedoverridevoid OnRenderToolStripBorder(ToolStripRenderEventArgs e)
{
GraphicsPath _roundedEdge =newGraphicsPath();
_roundedEdge.AddLine(_topLeftEdgeRadius, 0, e.ToolStrip.ClientRectangle.Width - _topRightEdgeRadius - 1, 0);
_roundedEdge.AddArc(e.ToolStrip.ClientRectangle.Width - _topRightEdgeRadius - 1 - _topRightEdgeRadius, _topRightEdgeRadius - _topRightEdgeRadius, 2 * _topRightEdgeRadius, 2 * _topRightEdgeRadius, -90, 90);
_roundedEdge.AddLine(e.ToolStrip.ClientRectangle.Width - 1, _topRightEdgeRadius, e.ToolStrip.ClientRectangle.Width - 1, e.ToolStrip.ClientRectangle.Height - _bottomRightEdgeRadius - 1);
_roundedEdge.AddArc(e.ToolStrip.ClientRectangle.Width - _bottomRightEdgeRadius - 1 - _bottomRightEdgeRadius, e.ToolStrip.ClientRectangle.Height - _bottomRightEdgeRadius - 1 - _bottomRightEdgeRadius, 2 * _bottomRightEdgeRadius, 2 * _bottomRightEdgeRadius, 0, 90);
_roundedEdge.AddLine(e.ToolStrip.ClientRectangle.Width - _bottomRightEdgeRadius - 1, e.ToolStrip.ClientRectangle.Height - 1, _bottomLeftEdgeRadius, e.ToolStrip.ClientRectangle.Height - 1);
_roundedEdge.AddArc(0, e.ToolStrip.ClientRectangle.Height - _bottomLeftEdgeRadius - 1 - _bottomLeftEdgeRadius, 2 * _bottomLeftEdgeRadius, 2 * _bottomLeftEdgeRadius, 90, 90);
_roundedEdge.AddLine(0, e.ToolStrip.ClientRectangle.Height - _bottomLeftEdgeRadius - 1, 0, _topLeftEdgeRadius);
_roundedEdge.AddArc(0, 0, 2 * _topLeftEdgeRadius, 2 * _topLeftEdgeRadius, 180, 90);
e.Graphics.DrawPath(newPen(Color.FromArgb(155,175,227)), _roundedEdge);
}
protectedoverridevoid OnRenderToolStripBackground(ToolStripRenderEventArgs e)
{
e.Graphics.SmoothingMode =SmoothingMode.AntiAlias;
e.Graphics.Clear(Color.FromArgb(213, 221, 242));
e.ToolStrip.GripStyle =ToolStripGripStyle.Hidden;
e.ToolStrip.Location =newPoint(200, 100);
e.ToolStrip.Width = 100;
e.ToolStrip.ForeColor =Color.Black;
e.ToolStrip.Font =newFont(FontFamily.GenericSerif, 10);
e.ToolStrip.BackColor =Color.FromArgb(213, 221, 242);
base.OnRenderToolStripBackground(e);
}
Pls. advise...
Thanks.
SenPluto.

