Exemplo n.º 1
0
        /// <summary>
        /// Render the <see cref="DXButton"/> onto the screen.
        /// </summary>
        public override void Render(RenderEventArgs e)
        {
            base.Render(e);
            DrawIcon(e.ControlHost.Device);
            Rectangle rect = new Rectangle(PointToScreen(Point.Empty), this.Size);

            CustomPainters.DrawBoundingRectangle(e.ControlHost, rect, Color.White);
            D3DFont.DrawString(null, this.Text, rect, DrawStringFormat.VerticalCenter | DrawStringFormat.Center, this.ForeColor);
        }
Exemplo n.º 2
0
        private void DrawHeaderShade(Device device)
        {
            if (this.headerBuffer == null)
            {
                this.headerBuffer = CustomPainters.CreateColoredBuffer(device);
            }
            Rectangle rect = new Rectangle(PointToScreen(Point.Empty), new Size(this.Width, 50));

            CustomPainters.PaintColoredRectangle(device, rect, this.headerBuffer, Color.DarkGoldenrod, Color.LightGoldenrodYellow, GradientDirection.Horizontal);
        }
Exemplo n.º 3
0
        private void DrawHighlight(Device device)
        {
            if (this.highlightBuffer == null)
            {
                this.highlightBuffer = CustomPainters.CreateColoredBuffer(device);
            }
            Point     origin = PointToScreen(Point.Empty);
            Rectangle rect   = new Rectangle(origin.X + 2, origin.Y + 2, this.Width - 4, this.Height - 4);

            CustomPainters.PaintColoredRectangle(device, rect, this.highlightBuffer, this.parentMenu.HighlightColor);
        }
Exemplo n.º 4
0
        private void ShadeBox(Device device)
        {
            if (this.shadeBuffer == null)
            {
                this.shadeBuffer = CustomPainters.CreateColoredBuffer(device);
            }
            Point     start = PointToScreen(Point.Empty);
            Rectangle rect  = new Rectangle(start.X, start.Y, 14, 14);

            CustomPainters.PaintColoredRectangle(device, rect, this.shadeBuffer, Color.Gray, Color.White, GradientDirection.Vertical);
        }
Exemplo n.º 5
0
        private void DrawBackGround(IDirectXControlHost controlHost)
        {
            if (this.backgroundBuffer == null)
            {
                this.backgroundBuffer = CustomPainters.CreateColoredBuffer(controlHost.Device);
            }
            Point     pt   = PointToScreen(Point.Empty);
            Rectangle rect = new Rectangle(pt.X, pt.Y + 25, this.Width, this.Height - 25);

            CustomPainters.PaintColoredRectangle(controlHost.Device, rect, this.backgroundBuffer, this.BackColor, this.BackColor2, GradientDirection.Vertical);
            CustomPainters.DrawBoundingRectangle(controlHost, new Rectangle(pt, this.Size), Color.White);
        }
Exemplo n.º 6
0
        private void UpdateVertexBuffer(Device device)
        {
            if (this.vertexBuffer == null)
            {
                this.vertexBuffer = CustomPainters.CreateColoredBuffer(device);
            }
            Point     origin = PointToScreen(Point.Empty);
            float     pct    = ((float)this.percentComplete) / 100f;
            float     x      = pct * (float)this.Width;
            float     y      = this.Height;
            Rectangle rect   = new Rectangle(origin, new Size((int)x, (int)y));

            CustomPainters.PaintColoredRectangle(device, rect, this.vertexBuffer, this.ForeColor, Color.DarkSlateBlue, GradientDirection.Vertical);
        }
Exemplo n.º 7
0
        //Draws the icon for the label.
        private void DrawIcon()
        {
            if (this.image == null)
            {
                return;
            }
            Rectangle rect = new Rectangle(PointToScreen(Point.Empty), this.image.Size);

            if (this.iconVertexBuffer == null)
            {
                this.iconVertexBuffer = CustomPainters.CreateTexturedBuffer(this.ControlHost.Device);
            }
            CustomPainters.PaintTexturedRectangle(this.ControlHost.Device, rect, this.iconVertexBuffer, image.Texture);
        }
Exemplo n.º 8
0
        private void DrawHeader(Device device)
        {
            if (this.headerBuffer == null)
            {
                this.headerBuffer = CustomPainters.CreateColoredBuffer(device);
            }

            Point     pt   = PointToScreen(Point.Empty);
            Rectangle rect = new Rectangle(PointToScreen(Point.Empty), new Size(this.Width, 25));

            CustomPainters.PaintColoredRectangle(device, rect, this.headerBuffer, this.headerColor1, this.headerColor2, GradientDirection.Horizontal);
            pt.Offset(3, 3);
            this.D3DFont.DrawString(null, this.Text, pt, Color.White);
        }
Exemplo n.º 9
0
        //Draws the icon for the button.
        private void DrawIcon(Device device)
        {
            if (this.icon == null)
            {
                return;
            }

            Point     start = PointToScreen(Point.Empty);
            Rectangle rect  = new Rectangle(new Point(start.X + 3, start.Y + 3), this.icon.Size);

            if (this.iconVertexBuffer == null)
            {
                this.iconVertexBuffer = CustomPainters.CreateTexturedBuffer(device);
            }
            CustomPainters.PaintTexturedRectangle(device, rect, this.iconVertexBuffer, this.icon.Texture);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Renders the <see cref="DXListBox"/>.
        /// </summary>
        public override void Render(RenderEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            base.Render(e);
            Color color = this.BorderColor;

            if (this.Focused || this.Hovered)
            {
                color = this.HoveredBorderColor;
            }
            CustomPainters.DrawBoundingRectangle(e.ControlHost, this.ScreenBounds, color);
            DrawItems(this.ScreenBounds, this.SelectedItem);
        }
Exemplo n.º 11
0
        private void DrawDropDown(IDirectXControlHost controlHost)
        {
            //draw the box
            Point     origin         = PointToScreen(Point.Empty);
            int       x              = origin.X;
            int       y              = origin.Y;
            int       bottom         = origin.Y + this.collapsedHeight;
            int       dropDownHeight = CalcDropDownHeight();
            Rectangle rect           = new Rectangle(x, bottom, this.Width, dropDownHeight);

            if (this.dropDownBuffer == null)
            {
                this.dropDownBuffer = CustomPainters.CreateColoredBuffer(controlHost.Device);
            }
            CustomPainters.PaintColoredRectangle(controlHost.Device, rect, dropDownBuffer, this.BackColor);
            CustomPainters.DrawBoundingRectangle(controlHost, rect, Color.DimGray);
            DrawItems(rect, this.hotItem);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Draws the highlight over the currently selected item in the <see cref="DXListControl"/>.
        /// </summary>
        /// <param name="e"></param>
        protected virtual void DrawHighlight(Rectangle bounds)
        {
            //create the vertex buffer for the highlight if necessary
            if (this.highlightBuffer == null)
            {
                this.highlightBuffer = CustomPainters.CreateColoredBuffer(this.ControlHost.Device);
            }

            //render the rectangle
            CustomPainters.PaintColoredRectangle(
                this.ControlHost.Device,
                bounds,
                this.highlightBuffer,
                this.highlightColor,
                this.highlightColor2,
                GradientDirection.Vertical
                );
        }
Exemplo n.º 13
0
        /// <summary>
        /// Renders the <see cref="DXCheckBox"/>.
        /// </summary>
        public override void Render(RenderEventArgs e)
        {
            Rectangle boxRect  = new Rectangle(PointToScreen(Point.Empty), new Size(14, 14));
            Rectangle textRect = new Rectangle(boxRect.X + 25, boxRect.Y, this.Size.Width - 25, this.Size.Height);

            ShadeBox(e.ControlHost.Device);
            if (this.isChecked)
            {
                Vector2[] checkedVerts = new Vector2[] {
                    new Vector2(boxRect.Right - 2, boxRect.Top + 2),
                    new Vector2(boxRect.Left + 5, boxRect.Bottom - 2),
                    new Vector2(boxRect.Left + 2, boxRect.Bottom - 6)
                };

                e.ControlHost.DrawLine(checkedVerts, Color.White);
            }
            CustomPainters.DrawBoundingRectangle(e.ControlHost, boxRect, Color.White);
            D3DFont.DrawString(null, this.Text, textRect, this.textFormat, this.ForeColor);
        }
Exemplo n.º 14
0
        //Shades the button of the combobox.
        private void ShadeButton(Device device, Rectangle rectangle)
        {
            if (this.shadeBuffer == null)
            {
                this.shadeBuffer = CustomPainters.CreateColoredBuffer(device);
            }
            if (this.pressedShadeBuffer == null)
            {
                this.pressedShadeBuffer = CustomPainters.CreateColoredBuffer(device);
            }

            if (this.expanded)
            {
                CustomPainters.PaintColoredRectangle(device, rectangle, this.pressedShadeBuffer, this.darkShade, this.lightShade, GradientDirection.Vertical);
            }
            else
            {
                CustomPainters.PaintColoredRectangle(device, rectangle, this.shadeBuffer, this.lightShade, this.darkShade, GradientDirection.Vertical);
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// Refreshes the control.
 /// </summary>
 public virtual void Render(RenderEventArgs e)
 {
     this.screenBounds = new Rectangle(PointToScreen(Point.Empty), this.size);
     if (this.backgroundImage == null)
     {
         if (this.vertexBuffer == null)
         {
             this.vertexBuffer = CustomPainters.CreateColoredBuffer(e.ControlHost.Device);
         }
         CustomPainters.PaintColoredRectangle(e.ControlHost.Device, this.screenBounds, this.vertexBuffer, this.backColor, this.backColor2, GradientDirection.Vertical);
     }
     else
     {
         if (this.vertexBuffer == null)
         {
             this.vertexBuffer = CustomPainters.CreateTexturedBuffer(e.ControlHost.Device);
         }
         CustomPainters.PaintTexturedRectangle(e.ControlHost.Device, this.screenBounds, this.vertexBuffer, this.backgroundImage.Texture);
     }
 }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
 /// <summary>
 /// Renders the <see cref="DXTextBox"/>.
 /// </summary>
 public override void Render(RenderEventArgs e)
 {
     base.Render(e);
     CustomPainters.DrawBoundingRectangle(e.ControlHost, this.ScreenBounds, Color.White);
     D3DFont.DrawString(null, this.Text, this.ScreenBounds, DrawStringFormat.Left, this.ForeColor);
 }