Ejemplo n.º 1
0
        /// <summary>
        /// Renders toolbar.
        /// </summary>
        /// <param name="graphics">graphics to render to.</param>
        /// <param name="X">X position.</param>
        /// <param name="Y">Y position.</param>
        protected override void Render(Graphics graphics, int x, int y)
        {
            base.Render(graphics, x, y);

            graphics.SetColor(this.Window.Desktop.Theme.Colors.ControlDark, this.Opacity);

            for (int i = 2; i < this.bounds.Height - 3; i += 2)
            {
                graphics.DrawRectangle(x + this.bounds.X + 4, y + this.bounds.Y + i, 3, 1);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Renders crontol border - check box
        /// </summary>
        /// <param name="graphics">graphics to render to</param>
        /// <param name="X">rendering offset X</param>
        /// <param name="Y">rendering offset Y</param>
        protected override void RenderBorder(Graphics graphics, int x, int y)
        {
            if (null == this.settings)
            {
                this.settings = this.Window.Desktop.Theme.GetControlSettings(TypeName);
            }

            int off = 2;
            int dx = 0;

            int size = this.settings.ControlSize;

            if (size <= 0)
            {
                size = this.Bounds.Height;
                dx = 0;
            }
            else
            {
                dx = (this.Bounds.Height - size) / 2;
            }

            //if (BorderStyle.BorderNone == this.Border)
            {
                off = 0;
            }

            off += dx;

            graphics.SetColor(this.settings.ColorBack);

            graphics.DrawRectangle(off + x + this.Bounds.X, off + y + this.Bounds.Y, size, size);

            graphics.SetColor(Colors.White);

            RenderBorderXYWH(graphics, off + x + this.Bounds.X, off + y + this.Bounds.Y, size, size, this.Border);

            this.TextOffset.X = off + size + 5;
        }
Ejemplo n.º 3
0
        protected override void RenderControls(Graphics graphics, int x, int y)
        {
            base.RenderControls(graphics, x, y);

            if (true == this.HasFocus)
            {
                RenderSelection(graphics, x, y);
            }
            else if ( (null != this.inputControl) && (true == this.inputControl.HasFocus) )
            {
                graphics.SetColor(this.Window.Desktop.Theme.Colors.Highlight, 0.5f);
                graphics.DrawRectangle(x + this.bounds.X + 1, y + this.bounds.Y + 1, this.bounds.Width / 2 - 1, this.bounds.Height - 2);

                graphics.SetColor(this.Window.Desktop.Theme.Colors.HighlightBorder, 0.5f);
                graphics.DrawBox(x + this.Bounds.X, y + this.Bounds.Y, this.Bounds.Width / 2, this.Bounds.Height);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Renders property row at X, Y position
        /// </summary>
        /// <param name="graphics">graphics api to do rendering</param>
        /// <param name="X">X coordinate</param>
        /// <param name="Y">Y coordiante</param>
        protected override void Render(Graphics graphics, int x, int y)
        {
            if (null == this.parentGrid)
            {
                this.parentGrid = (PropertyGrid)this.Parent.Parent;
            }

            if (true == this.parentGrid.ShowRowsSeparator)
            {
                graphics.SetColor(this.parentGrid.RowSeparatorColor);
                graphics.DrawRectangle(x + this.Bounds.X, y + this.Bounds.Y + this.Bounds.Height, this.Bounds.Width, this.parentGrid.RowSeparatorHeight);
            }

            if (true == this.parentGrid.ShowKeyValueSeparator)
            {
                graphics.SetColor(this.parentGrid.KeyValueSeparatorColor);
                graphics.DrawRectangle(x + this.Bounds.X + this.Bounds.Width / 2, y + this.Bounds.Y, this.parentGrid.KeyValueSeparatorWidth, this.Bounds.Height);
            }

            RenderName(graphics, x, y);

            if (null == this.property)
            {
                return;
            }

            //RenderValue(render, X, Y);

            if (null != this.inputControl)
            {
                this.inputControl.Bounds.UpdateSize(this.Bounds.Width / 2 + 1, 1, this.Bounds.Width / 2-1, this.Bounds.Height-1);
            }
            else
            {
                CreateInputControl();
            }

            //if (false == this.inputControl.HasFocus())
            {
                if (this.property.ToString() != this.inputControl.Text)
                {
                    this.inputControl.Text = this.property.ToString();
                }
            }

            if (true == this.parentGrid.ShowSideBar)
            {
                this.IconImageOffset.X = 16;
                this.TextOffset.X = 16;
            }
            else
            {
                this.IconImageOffset.X = 0;
                this.TextOffset.X = 0;
            }

            RenderControls(graphics, x, y);
        }
Ejemplo n.º 5
0
        protected override void Render(Graphics graphics, int x, int y)
        {
            if (null == this.parentGrid)
            {
                this.parentGrid = (PropertyGrid)this.Parent;
            }

            int hh = 8 + this.parentGrid.FontInfo.Size;

            if (true == this.parentGrid.ShowSideBar)
            {
                // Render TopLine
                graphics.SetColor(this.Window.Desktop.Theme.Colors.Control);
                graphics.DrawRectangle(x + this.Bounds.X, y + this.Bounds.Y, this.Bounds.Width, hh);
            }

            if (true == this.parentGrid.ShowGroupLine)
            {
                graphics.SetColor(this.parentGrid.BorderColor);
                graphics.DrawRectangle(x + this.bounds.X, y + this.bounds.Y + hh - 1, this.bounds.Width, 1);
            }

            if (true == this.parentGrid.ShowPlus)
            {
                // Render Plus
                graphics.SetColor(this.PlusColor);
                graphics.DrawRectangle(this.Bounds.X + x + 3, this.Bounds.Y + y + 4, hh - 7, hh - 7);
                graphics.SetColor(this.Window.Desktop.Theme.Colors.Control);
                graphics.DrawRectangle(this.Bounds.X + x + 4, this.Bounds.Y + y + 5, hh - 9, hh - 9);
                graphics.SetColor(this.PlusColor);
                graphics.DrawRectangle(this.Bounds.X + x + 2 + 3, this.Bounds.Y + y + 4 + 4, 4 + 1, 1);

                if (false == this.expanded)
                {
                    graphics.DrawRectangle(this.Bounds.X + x + 2 + 2 + 3, this.Bounds.Y + y + 1 + 5, 1, 5);
                }

                if (true == this.HasFocus)
                {
                    graphics.SetColor(this.Window.Desktop.Theme.Colors.HighlightBorder, 0.5f);
                    graphics.DrawBox(x + this.bounds.X, y + this.bounds.Y, this.bounds.Width, hh);
                    graphics.SetColor(this.Window.Desktop.Theme.Colors.Highlight, 0.5f);
                    graphics.DrawRectangle(x + this.bounds.X + 1, y + this.bounds.Y + 1, this.bounds.Width - 2, hh - 2);
                }

                // Render text
                graphics.SetColor(this.parentGrid.TextColor);
                if (null != this.parentGrid.FontInfo.Font)
                {
                    this.parentGrid.FontInfo.Font.DrawText(graphics, this.Bounds.X + x + hh, this.Bounds.Y + y + 4, this.controlText);
                }
            }
            else
            {
                if (true == this.HasFocus)
                {
                    graphics.SetColor(this.Window.Desktop.Theme.Colors.HighlightBorder, 0.5f);
                    graphics.DrawBox(x + this.bounds.X, y + this.Bounds.Y, this.bounds.Width, hh);
                    graphics.SetColor(this.Window.Desktop.Theme.Colors.Highlight, 0.5f);
                    graphics.DrawRectangle(x + this.Bounds.X + 1, y + this.Bounds.Y + 1, this.Bounds.Width - 2, hh - 2);
                }

                // Render text
                graphics.SetColor(this.parentGrid.TextColor);
                if (null != this.parentGrid.FontInfo.Font)
                {
                    this.parentGrid.FontInfo.Font.DrawText(graphics, this.Bounds.X + x + 3, this.Bounds.Y + y + 4, this.controlText);
                }
            }

            // Render text
            if ((0 != this.parentGrid.ValueText.Length) && (null != this.parentGrid.FontInfo.Font))
            {
                graphics.SetColor(this.parentGrid.TextColor);
                this.parentGrid.FontInfo.Font.DrawText(graphics, 4 + x + this.Bounds.X + this.Bounds.Width / 2, this.Bounds.Y + y + 4, this.parentGrid.ValueText);
            }

            RenderControls(graphics, x, y);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Renders property grid at X, Y position.
        /// </summary>
        /// <param name="graphics">graphics api for rendering.</param>
        /// <param name="X">X coordiante.</param>
        /// <param name="Y">Y coordinate.</param>
        protected override void Render(Graphics graphics, int x, int y)
        {
            RenderBackground(graphics, x, y);
            RenderBorder(graphics, x, y);

            if (true == this.ShowSideBar)
            {
                graphics.SetColor(this.Window.Desktop.Theme.Colors.Control);
                graphics.DrawRectangle(x + this.Bounds.X + 1, y + this.Bounds.Y + 1, 14, this.Bounds.Height - 2);
            }

            RenderControls(graphics, x, y);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Renders control.
        /// </summary>
        /// <param name="graphics">graphics to render to</param>
        /// <param name="X">X screen offset</param>
        /// <param name="Y">Y screen offset</param>
        protected override void RenderControls(Graphics graphics, int x, int y)
        {
            int borderSize = 2;

            if (BorderStyle.None == this.Border)
            {
                borderSize = 0;
            }

            int tx = x + this.Bounds.X + borderSize;
            int ty = y + this.Bounds.Y + borderSize;

            int tw = (int)((float)(this.Bounds.Width - borderSize * 2) * this.ProgressValue);

            graphics.SetColor(this.ProgressBarColor);
            graphics.DrawRectangle(tx, ty, tw, this.Bounds.Height - borderSize * 2);
        }
Ejemplo n.º 8
0
        protected override void Render(Graphics graphics, int x, int y)
        {
            CalculateSizes();

            if ( (true == this.horizontalScrollBar.Visible) && (true == this.verticalScrollBar.Visible) )
            {
                int w = this.horizontalScrollBar.ButtonSize;

                graphics.SetColor(this.Window.Desktop.Theme.Colors.Control, this.Opacity);

                graphics.DrawRectangle(x + this.bounds.X + this.bounds.Width - w - this.borderSize, y + this.bounds.Y + this.bounds.Height - w - this.borderSize, w, w);
            }

            base.Render(graphics, x, y);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Renders control background at X, Y position.
        /// </summary>
        /// <param name="graphics">graphics to render to.</param>
        /// <param name="X">X coordinate.</param>
        /// <param name="Y">Y coordinate.</param>
        protected override void RenderBackground(Graphics graphics, int x, int y)
        {
            base.RenderBackground(graphics, x, y);

            if ( (true == this.TicksVisible) && (0 != this.TicksCount) )
            {
                if (true == this.Vertical)
                {
                    int w = this.Bounds.Width / 2 + this.Bounds.X + x;

                    if (true == this.BottomTicksVisible)
                    {
                        w += 4;
                    }
                    else
                    {
                        w -= 10 + 4;
                    }

                    if (this.TicksCount > 0)
                    {
                        int h = this.Bounds.Height - 1;

                        graphics.SetColor(this.TextColor);

                        float step = 1.0f / this.ticksCount;

                        for (float i = 0; i < 1.001f; i += step)
                        {
                            graphics.DrawRectangle(w, (int)(this.Bounds.Y + y + h * i), 5, 1);
                        }
                    }
                }
                else
                {
                    int h = this.Bounds.Height / 2 + this.Bounds.Y + y;

                    if (true == this.BottomTicksVisible)
                    {
                        h += 4;
                    }
                    else
                    {
                        h -= 10 + 4;
                    }

                    if (this.TicksCount > 0)
                    {
                        int w = this.Bounds.Width - 1;

                        graphics.SetColor(this.TextColor);

                        float step = 1.0f / this.TicksCount;

                        for (float i = 0; i < 1.001f; i += step)
                        {
                            graphics.DrawRectangle((int)(this.Bounds.X + x + w * i), h, 1, 5);
                        }
                    }
                }
            }

            if ((false == this.Vertical) && (null != this.FontInfo.Font))
            {
                int h = this.Bounds.Height / 2 + this.Bounds.Y + y;

                if (true == this.BottomTicksVisible)
                {
                    h += 4 + 5;
                }
                else
                {
                    h -= 4 + 5 + this.FontInfo.Font.TextHeight(this.maxText) + 7;
                }

                this.FontInfo.Font.DrawText(graphics, this.Bounds.X + x, h, this.minText);
                this.FontInfo.Font.DrawText(graphics, this.Bounds.X + x + this.Bounds.Width - this.FontInfo.Font.TextLength(this.maxText), h, this.maxText);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Renders design window and editable window.
        /// </summary>
        /// <param name="graphics">graphics to render to</param>
        /// <param name="X">rendering X position</param>
        /// <param name="Y">rendering Y position</param>
        protected override void Render(Graphics graphics, int x, int y)
        {
            base.Render(graphics, x, y);

            if (null != this.activeWindow)
            {
                // draw outline (windows border is too thick to default outline to be visible)
                if (this.activeControl == this.activeWindow)
                {
                    graphics.SetColor(this.Desktop.Theme.Colors.HighlightBorder, this.Opacity);
                    graphics.DrawRectangle(x + this.Bounds.X - 4 + this.activeWindow.Bounds.X, y + this.Bounds.Y - 4 + this.activeWindow.Bounds.Y, this.activeWindow.Bounds.Width + 8, this.activeWindow.Bounds.Height + 8);
                }

                this.activeWindow.RenderInternal(graphics, x + this.Bounds.X, y + this.Bounds.Y);
            }
        }