コード例 #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);
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: ListBox.cs プロジェクト: leemcknight/Similization
        /// <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);
        }
コード例 #4
0
ファイル: ComboBox.cs プロジェクト: leemcknight/Similization
        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);
        }
コード例 #5
0
ファイル: Checkbox.cs プロジェクト: leemcknight/Similization
        /// <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);
        }
コード例 #6
0
ファイル: ComboBox.cs プロジェクト: leemcknight/Similization
        /// <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);
        }
コード例 #7
0
ファイル: TextBox.cs プロジェクト: leemcknight/Similization
 /// <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);
 }