Exemple #1
0
        public override void DrawText(Graphics graphics, int x, int y, string text, int start, int stop)
        {
            if ((null == text) || (text.Length == 0))
            {
                return;
            }

            int renderX = x;

            if (stop < 0)
            {
                stop = (int)(text.Length);
            }

            if (stop > text.Length)
            {
                stop = text.Length;
            }

            if (start < 0)
            {
                start = 0;
            }

            for (int i = start; i < stop; i++)
            {
                graphics.DrawBox(renderX, y, this.size / 2, this.size);

                renderX += this.size / 2 + 2;
            }
        }
Exemple #2
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);
            }
        }
Exemple #3
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);
        }
Exemple #4
0
        protected override void Render(Graphics graphics, int x, int y)
        {
            this.menuButton.Width = this.Width - 80;
            this.menuButton.X = 40;
            this.menuButton.Y = this.Height - 100;

            int y1 = this.Height - 150;

            foreach (var button in this.Controls)
            {
                if ((button != this.menuButton))
                {
                    button.Width = this.Width-80;
                    button.Height = 28;
                    button.FontInfo.Name = "Calibri";
                    button.FontInfo.Bold = true;
                    button.FontInfo.Size = 18;
                    button.TextColor = Colors.White;
                    button.BackColor = Colors.None;
                    button.Border = BorderStyle.None;
                    button.X = 40;
                    button.Y = y1;
                    button.Visible = this.Active;

                    y1 -= 50;
                }
            }

            graphics.SetColor(Colors.Red);

            if (this.Active == true)
            {
                var rx = (int)(5.0 * Math.Sin(Math.PI * 2 * DateTime.Now.Millisecond / 1000));
                var rw = this.Width - 20 + (int)(5.0 * Math.Cos(Math.PI * 2 * DateTime.Now.Millisecond / 1000));

                graphics.DrawBox(this.Bounds.X + x + rx, this.Bounds.Y + y + 0, rw, this.Height);
            }
            else
            {
                var rx = (this.Width - 15) / 2 + (int)(5.0 * Math.Sin(Math.PI * 2 * DateTime.Now.Millisecond / 1000));
                var rw = 15 + (int)(5.0 * Math.Cos(Math.PI * 2 * DateTime.Now.Millisecond / 1000));

                graphics.DrawBox(this.Bounds.X + x + rx, this.Bounds.Y + y + 0, rw, this.Height);
            }

            base.Render(graphics, x, y);
        }