コード例 #1
0
        public void Draw(Font f, Rectangle r, bool color)
        {
            int arrowWidth = (int)f.maxWidth / 4;

            string    valueAsString  = " " + options[OptionIndex].ToString() + " ";
            Point     p              = f.TextSize(valueAsString);
            Rectangle numericRect    = new Rectangle(new Point(Lcd.Width - p.X, r.P1.Y), r.P2);
            Rectangle textRect       = new Rectangle(new Point(r.P1.X, r.P1.Y), new Point(r.P2.X - (p.X), r.P2.Y));
            Rectangle leftArrowRect  = new Rectangle(new Point(numericRect.P1.X, numericRect.P1.Y + arrowEdge), new Point(numericRect.P1.X + arrowWidth, numericRect.P2.Y - arrowEdge));
            Rectangle rightArrowRect = new Rectangle(new Point(numericRect.P2.X - (arrowWidth + rightArrowOffset), numericRect.P1.Y + arrowEdge), new Point(numericRect.P2.X - rightArrowOffset, numericRect.P2.Y - arrowEdge));

            lcd.WriteTextBox(f, textRect, text, color, Lcd.Alignment.Left);
            lcd.WriteTextBox(f, numericRect, valueAsString, color, Lcd.Alignment.Right);
            lcd.DrawArrow(leftArrowRect, Lcd.ArrowOrientation.Left, color);
            lcd.DrawArrow(rightArrowRect, Lcd.ArrowOrientation.Right, color);
        }
コード例 #2
0
ファイル: ItemList.cs プロジェクト: smallrobots/monoev3
        private void DrawItemList()
        {
            if (!isItemSizeCalculated)
            {
                CalculateItemSize();
                isItemSizeCalculated = true;
            }
            Lcd.Clear();
            Rectangle currentPos = new Rectangle(new Point(0, 0), itemSize);
            Rectangle arrowRect  = new Rectangle(new Point(Lcd.Width / 2 - arrowWidth / 2, Lcd.Height - arrowHeight), new Point(Lcd.Width / 2 + arrowWidth / 2, Lcd.Height - 1));

            Lcd.WriteTextBox(font, currentPos, title, true, Lcd.Alignment.Center);
            int i = 0;

            while (i != itemsOnScreen)
            {
                if (i + scrollPos >= items.Count)
                {
                    break;
                }
                items [i + scrollPos].OnDrawTitle(font, currentPos + itemHeight * (i + 1), i != cursorPos);
                i++;
            }
            Lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Down, scrollPos + itemsOnScreen < items.Count);
            Lcd.Update();
        }
コード例 #3
0
ファイル: ItemList.cs プロジェクト: smallrobots/monoev3
        public void OnDrawTitle(Font font, Rectangle rectangle, bool selected)
        {
            Lcd.WriteTextBox(font, rectangle, title, selected);
            int       arrowWidth = (int)font.maxWidth / 3;
            Rectangle arrowRect  = new Rectangle(new Point(rectangle.P2.X - (arrowWidth + arrowOffset), rectangle.P1.Y + arrowEdge), new Point(rectangle.P2.X - arrowOffset, rectangle.P2.Y - arrowEdge));

            Lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Right, selected);
        }
コード例 #4
0
ファイル: Buttons.cs プロジェクト: smallrobots/monoev3
 public override void Draw()
 {
     Lcd.DrawRectangle(outherBox, true, true);
     Lcd.DrawRectangle(innerBox, Selected, true);
     Lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Left, !Selected);
     Lcd.DrawLine(new Point(arrowRect.P2.X, outherBox.P1.Y + ((outherBox.P2.Y - outherBox.P1.Y) / 2)), new Point(outherBox.P2.X - 8 * characterEdge, outherBox.P1.Y + ((outherBox.P2.Y - outherBox.P1.Y) / 2)), !Selected);
     Lcd.DrawLine(new Point(outherBox.P2.X - 8 * characterEdge, outherBox.P1.Y + ((outherBox.P2.Y - outherBox.P1.Y) / 2)), new Point(outherBox.P2.X - 8 * characterEdge, outherBox.P1.Y + 4 * characterEdge), !Selected);
 }
コード例 #5
0
ファイル: MenuItemWithAction.cs プロジェクト: thaiEv3/monoev3
 public void Draw(Font f, Rectangle r, bool color)
 {
     lcd.WriteTextBox(f, r, text, color);
     if (symbole == MenuItemSymbole.LeftArrow || symbole == MenuItemSymbole.RightArrow)
     {
         int       arrowWidth = (int)f.maxWidth / 3;
         Rectangle arrowRect  = new Rectangle(new Point(r.P2.X - (arrowWidth + arrowOffset), r.P1.Y + arrowEdge), new Point(r.P2.X - arrowOffset, r.P2.Y - arrowEdge));
         if (symbole == MenuItemSymbole.LeftArrow)
         {
             lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Left, color);
         }
         else
         {
             lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Right, color);
         }
     }
 }
コード例 #6
0
ファイル: Buttons.cs プロジェクト: smallrobots/monoev3
 public override void Draw()
 {
     Lcd.DrawRectangle(outherBox, true, true);
     Lcd.DrawRectangle(innerBox, Selected, true);
     Lcd.WriteText(Font.SmallFont, textCenterPoint + textDisplacement, Text, !Selected);
     Lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Up, !Selected);
     Lcd.DrawVLine(lineStart, lineLength, !Selected);
     Lcd.DrawVLine(lineStart + new Point(-1, 0), lineLength, !Selected);
     Lcd.DrawVLine(lineStart + new Point(+1, 0), lineLength, !Selected);
 }
コード例 #7
0
ファイル: SelectDialog.cs プロジェクト: smallrobots/monoev3
 protected override void OnDrawContent()
 {
     for (int i = 0; i != lines.Count; ++i)
     {
         if (i + scrollPos >= options.Length)
         {
             break;
         }
         WriteTextOnLine(options [i + scrollPos].ToString(), i, i != cursorPos);
     }
     Lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Down, scrollPos + lines.Count < options.Length);
 }
コード例 #8
0
ファイル: Buttons.cs プロジェクト: smallrobots/monoev3
 public override void Draw()
 {
     if (Disabled)
     {
         Lcd.DrawRectangle(outherBox, true, true);
         Lcd.DrawRectangle(innerBox, Selected, true);
         Lcd.DrawLine(outherBox.P1, outherBox.P2, !Selected);
         Lcd.DrawLine(new Point(outherBox.P1.X, outherBox.P2.Y), new Point(outherBox.P2.X, outherBox.P1.Y), !Selected);
         return;
     }
     Lcd.DrawRectangle(outherBox, true, true);
     Lcd.DrawRectangle(innerBox, Selected, true);
     Lcd.DrawArrow(arrowRect, arrowOrientation, !Selected);
 }
コード例 #9
0
ファイル: Menu.cs プロジェクト: thaiEv3/monoev3
        private void RedrawMenu()
        {
            lcd.Clear();
            Rectangle currentPos = new Rectangle(new Point(0, 0), itemSize);
            Rectangle arrowRect  = new Rectangle(new Point(Lcd.Width / 2 - arrowWidth / 2, Lcd.Height - arrowHeight), new Point(Lcd.Width / 2 + arrowWidth / 2, Lcd.Height - 1));

            lcd.WriteTextBox(font, currentPos, title, true, Lcd.Alignment.Center);
            int i = 0;

            while (i != itemsOnScreen)
            {
                if (i + scrollPos >= menuItems.Length)
                {
                    break;
                }
                menuItems [i + scrollPos].Draw(font, currentPos + itemHeight * (i + 1), i != cursorPos);
                i++;
            }
            lcd.DrawArrow(arrowRect, Lcd.ArrowOrientation.Down, scrollPos + itemsOnScreen < menuItems.Length);
            lcd.Update();
        }