Beispiel #1
0
        public override void Draw(Canvas canvas)
        {
            destRect.left = X;
            destRect.top = Y;
            destRect.right = X + ClipWidth;
            destRect.bottom = Y + ClipHeight;

            if (texture != null)
            {
                if (animated)
                {
                    srcRect.right = srcRect.left + (int)frameWidth;
                    srcRect.bottom = srcRect.top + (int)frameHeight;
                    canvas.DrawTexturePart(texture, destRect, srcRect, Rotation);
                }
                else
                    canvas.DrawTextureFull(texture, destRect, Rotation);
                if (fComponent.InFocus)
                {
                    canvas.DrawRect(destRect, Color.Red);
                }
            }
            else
            {
                if (fComponent.InFocus)
                    currentColor = Color.Red;
                else currentColor = Color.Green;

                canvas.DrawRect(destRect, currentColor);
            }
        }
Beispiel #2
0
        public override void Draw(Canvas canvas)
        {
            if (needReDraw)
            {
                if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(opt.fontName))
                    texture = null;
                else
                    texture = TextRenderer.RenderText(opt, text);

                needReDraw = false;
            }

            destRect.left = X;
            destRect.top = Y;
            destRect.right = X + ClipWidth;
            destRect.bottom = Y + ClipHeight;

            if (texture != null)
            {
                canvas.DrawTextureFull(texture, destRect, 0);
                if (fComponent.InFocus)
                {
                    canvas.DrawRect(destRect, Color.Red);
                }
            }
            else
            {
                if (fComponent.InFocus)
                    currentColor = Color.Red;
                else currentColor = Color.Green;

                canvas.DrawRect(destRect, currentColor);
            }
        }