コード例 #1
0
        public override void Draw(CellSurface surface, Rectangle area)
        {
            if (Item is Color || Item is Tuple <Color, Color, string> )
            {
                string value = new string(' ', area.Width - 2);

                CellAppearance cellLook = _currentAppearance.Clone();

                if (Item is Color)
                {
                    cellLook.Background = (Color)Item;
                    surface.Print(area.X + 1, area.Y, value, cellLook);
                }
                else
                {
                    cellLook.Foreground = ((Tuple <Color, Color, string>)Item).Item2;
                    cellLook.Background = ((Tuple <Color, Color, string>)Item).Item1;
                    value = ((Tuple <Color, Color, string>)Item).Item3.Align(HorizontalAlignment.Left, area.Width - 2);
                    surface.Print(area.X + 1, area.Y, value, cellLook);
                }

                surface.Print(area.X, area.Y, " ", _currentAppearance);
                surface.Print(area.X + area.Width - 1, area.Y, " ", _currentAppearance);

                if (IsSelected)
                {
                    surface.SetCharacter(area.X, area.Y, 16);
                    surface.SetCharacter(area.X + area.Width - 1, area.Y, 17);
                }

                IsDirty = false;
            }
            else
            {
                base.Draw(surface, area);
            }
        }