Example #1
0
        void DrawArrayProperty(string key, ParserItem it)
        {
            if (CanDraw)
            {
                // Create Key Item
                var KeyItem = CreateTextLayout(string.Format("\"{0}\"", key));

                // Create rectangle
                var rect = new Rectangle(X, Y, KeyItem.GetSize().Width, KeyItem.GetSize().Height).Inflate(0.2, 0.2);

                // Clikable item
                CreateClickableItem((double)X, (double)Y, KeyItem.GetSize().Width, KeyItem.GetSize().Height, it);

                // Draw rect
                CTX.SetColor(Colors.DarkGreen);
                CTX.Rectangle(rect);
                CTX.Fill();
                CTX.SetLineWidth(1);
                CTX.Stroke();
                CTX.SetColor(Colors.White);
                CTX.DrawTextLayout(KeyItem, X, Y);
                CTX.SetColor(Colors.Black);

                // Draw [
                double newX = X + KeyItem.GetSize().Width + 0.2;
                CTX.DrawTextLayout(CreateTextLayout(" : ["), newX, Y);
            }
        }
Example #2
0
        void DrawColorProperty(string key, string value, Color c, ParserItem item, bool comma = true)
        {
            if (CanDraw)
            {
                double newX = X;
                if (key != null)
                {
                    var Item = CreateTextLayout(string.Format("\"{0}\" : ", key));
                    CTX.DrawTextLayout(Item, X, Y);
                    newX = X + Item.GetSize().Width;
                }

                if (DrawVisibleProperty == false)
                {
                    CTX.DrawTextLayout(CreateTextLayout(value), newX, Y);
                    return;
                }

                // Create value
                var Value = new TextLayout();
                Value.Font.WithSize(10);
                Value.Text = value;
                var s    = Value.GetSize();
                var rect = new Rectangle(newX, Y, s.Width, s.Height).Inflate(0.2, 0.2);
                CreateClickableItem((double)newX, (double)Y, s.Width, s.Height, item);
                CTX.SetColor(c);
                CTX.Rectangle(rect);
                CTX.Fill();
                CTX.SetLineWidth(1);
                CTX.Stroke();
                CTX.SetColor(Colors.White);
                CTX.DrawTextLayout(Value, newX, Y);
                CTX.SetColor(Colors.Black);

                if (comma)
                {
                    var end = CreateTextLayout(",");
                    CTX.DrawTextLayout(end, newX + s.Width + 8, Y);
                }
            }
        }