AnimatGuiCtrls.Controls.DropDownPaintEventArgs.DrawFocusRectangle C# (CSharp) Method

DrawFocusRectangle() public method

Draws a focus rectangle on the editable portion of the control.
public DrawFocusRectangle ( ) : void
return void
        public void DrawFocusRectangle()
        {
            Rectangle focus = Bounds;
            focus.Inflate(-2, -2);
            focus.Width++;
            ControlPaint.DrawFocusRectangle(Graphics, focus);
        }

Usage Example

        /// <summary>
        /// Paints the selected node in the control.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaintContent(DropDownPaintEventArgs e)
        {
            base.OnPaintContent(e);

            Image  img  = GetNodeImage(selectedNode);
            string text = (selectedNode != null) ? ((showPath) ? Path : selectedNode.Text) : nullValue;

            Rectangle imgBounds = (img == null) ? new Rectangle(1, 0, 0, 0) : new Rectangle(4, e.Bounds.Height / 2 - img.Height / 2, img.Width, img.Height);
            Rectangle txtBounds = new Rectangle(imgBounds.Right, 0, e.Bounds.Width - imgBounds.Right - 3, e.Bounds.Height);

            if (img != null)
            {
                e.Graphics.DrawImage(img, imgBounds);
            }

            TextRenderer.DrawText(e.Graphics, text, Font, txtBounds, ForeColor, TEXT_FORMAT_FLAGS);

            // focus rectangle
            if (Focused && ShowFocusCues && !DroppedDown)
            {
                e.DrawFocusRectangle();
            }
        }
All Usage Examples Of AnimatGuiCtrls.Controls.DropDownPaintEventArgs::DrawFocusRectangle