protected override void OnPaint()

in wwauth/Google.Solutions.WWAuth/View/DropDownButton.cs [78:117]


        protected override void OnPaint(PaintEventArgs args)
        {
            base.OnPaint(args);

            if (this.Menu != null && this.SplitWidth > 0)
            {
                //
                // Draw arrow.
                //
                int arrowX = this.ClientRectangle.Width - 14;
                int arrowY = this.ClientRectangle.Height / 2 - 1;

                var arrowBrush = this.Enabled
                    ? SystemBrushes.ControlText
                    : SystemBrushes.ButtonShadow;

                var arrowPoints = new[]
                {
                    new Point(arrowX, arrowY),
                    new Point(arrowX + 7, arrowY),
                    new Point(arrowX + 3, arrowY + 4)
                };

                args.Graphics.FillPolygon(arrowBrush, arrowPoints);

                //
                // Draw a dashed separator.
                //
                int lineX = this.ClientRectangle.Width - this.SplitWidth;
                int lineYFrom = arrowY - 4;
                int lineYTo = arrowY + 8;
                using (var separatorPen = new Pen(Brushes.DarkGray)
                {
                    DashStyle = DashStyle.Dot
                })
                {
                    args.Graphics.DrawLine(separatorPen, lineX, lineYFrom, lineX, lineYTo);
                }
            }
        }