Beispiel #1
0
        /// <summary>
        /// Renders the <see cref="DXComboBox"/>.
        /// </summary>
        public override void Render(RenderEventArgs e)
        {
            //have to recalc the size since we might be expanded.  In that case,
            //we don't want the button to cover the entire size of the control,
            //just the height as it is when collapsed.
            Size buttonSize = new Size(this.Width, this.collapsedHeight);

            //create the rectangle for the button portion of the combobox
            Rectangle rect = new Rectangle(PointToScreen(Point.Empty), buttonSize);

            //shade the rectangle
            ShadeButton(e.ControlHost.Device, rect);


            if (this.expanded)
            {
                DrawDropDown(e.ControlHost);
            }

            //draw the bounding rectangle around the button portion
            Color color = this.BorderColor;

            if (this.Hovered || this.Focused)
            {
                color = this.HoveredBorderColor;
            }
            CustomPainters.DrawBoundingRectangle(e.ControlHost, rect, color);

            //draw the arrow
            if (this.arrowBuffer == null)
            {
                this.arrowBuffer = CustomPainters.CreateColoredTriangleBuffer(e.ControlHost.Device);
            }
            Rectangle arrowRect = new Rectangle(this.Location.X + this.Size.Width - 20, this.Location.Y + 5, 15, collapsedHeight - 10);

            CustomPainters.PaintColoredTriangle(e.ControlHost.Device, arrowRect, this.arrowBuffer, color);

            this.D3DFont.DrawString(null, this.Text, rect, DrawStringFormat.Left, this.ForeColor);
        }