Ejemplo n.º 1
0
        public void Update(Controles controles)
        {
            rectangle = new Rectangle((int)position.X, (int)position.Y, (int)font.MeasureString(text).X, (int)font.MeasureString(text).Y);
            Rectangle mouse = new Rectangle((int)controles.cursorPosition.X - 2, (int)controles.cursorPosition.Y - 2, (int)controles.cursorPosition.X + 2, (int)controles.cursorPosition.Y + 2);

            if (mouse.Intersects(rectangle) && controles.Click() && IsEditable)
            {
                IsEdited = true;
            }
            if (IsEdited)
            {
                if (controles.Enter())
                {
                    IsEdited = false;
                    IsFinish = true;
                }
                else
                {
                    String tmp = text;
                    InputEvents.UpdateText(controles, ref tmp);
                    text = tmp;
                    cursor.Update(text, true);
                }
            }
            else
            {
                cursor.Update(text, false);
            }
            if (controles.Enter() && IsEdited)
            {
                IsEdited = false;
            }
        }