예제 #1
0
        protected override void Draw(Point location, Eto.Forms.MouseEventArgs e)
        {
            if (e.Buttons == MouseButtons.Primary)
            {
                var action  = new Actions.Block.Fill(Handler);
                var rect    = new Rectangle(location, new Size(this.Size, this.Size));
                var attribs = action.Attributes = new FillAttributes
                {
                    Rectangle = rect,
                    Mode      = Controls.FillMode.Character
                };

                var inverted = e.Modifiers.HasFlag(Keys.Shift) ^ Inverted;
                attribs.Character = new Character((inverted) ? (Character)32 : CurrentCharacter);

                if (e.Modifiers.HasFlag(Keys.Alt) ^ ApplyColour)
                {
                    attribs.Mode     |= Controls.FillMode.Attribute;
                    attribs.Attribute = Handler.DrawAttribute;
                }
                action.Execute();

                var middle = (Size - 1) / 2;

                UpdateCursorPosition(new Point(location.X + middle, location.Y + middle), rect);
            }
        }