Example #1
0
        void DrawText(DrawBoard d)
        {
            //d.DrawText(_mybuffer,
            //     new Rectangle(0, 0, bWidth, bHeight),
            //     style.ContentHAlign);

            if (_renderVxFormattedString == null)
            {
                _renderVxFormattedString = d.CreateFormattedString(_mybuffer, 0, _mybuffer.Length, DelayFormattedString);
            }

            switch (_renderVxFormattedString.State)
            {
            case RenderVxFormattedString.VxState.Ready:
                d.DrawRenderVx(_renderVxFormattedString, 0, 0);
                break;

            case RenderVxFormattedString.VxState.NoStrip:
            {
                //put this to the update queue system
                //(TODO: add extension method for this)
                GlobalRootGraphic.CurrentRootGfx.EnqueueRenderRequest(
                    new RenderBoxes.RenderElementRequest(
                        s_currentRenderE,
                        RenderBoxes.RequestCommand.ProcessFormattedString,
                        _renderVxFormattedString));
            }
            break;
            }
        }
Example #2
0
        public override void CustomDrawToThisCanvas(DrawBoard canvas, Rectangle updateArea)
        {
            if (this.textBuffer != null)
            {
                var prevColor = canvas.CurrentTextColor;
                canvas.CurrentTextColor = textColor;
                canvas.CurrentFont      = _font;

                //for faster text drawing
                //we create a formatted-text
                //canvas.DrawText(this.textBuffer, this.X, this.Y);
                if (renderVxFormattedString == null)
                {
                    renderVxFormattedString = canvas.CreateFormattedString(textBuffer, 0, textBuffer.Length);
                }
                canvas.DrawRenderVx(renderVxFormattedString, this.X, this.Y);
                canvas.CurrentTextColor = prevColor;
            }
        }