Пример #1
0
        private void CreatepictureBox(IRenderable renderableObject)
        {
            var spriteImage = GetSpriteImage(renderableObject);
            var picBox      = new CustomPictureBox
            {
                BackColor = Color.Transparent,
                Image     = spriteImage,
                Location  = new Point(renderableObject.X, renderableObject.Y),
                Size      = new Size(renderableObject.SizeX, renderableObject.SizeY),
                Parent    = this.gameWindow,
                Tag       = new CustomPicBoxTag(renderableObject, this.Controller)
            };

            if (renderableObject is BasicAttack)
            {
                var ability = (BasicAttack)renderableObject;
                picBox.Location = new Point(ability.VisualX, ability.VisualY);
                picBox.Size     = new Size(ability.VisualSizeX, ability.VisualSizeY);
            }
            this.pictureBoxes.Add(picBox);
            this.gameWindow.Controls.Add(picBox);
            //test
            picBox.BringToFront();
            //picBox.BackColor = Color.Transparent;
            //endTest
        }
Пример #2
0
        public void SetBackground(IRenderable renderableObject)
        {
            var spriteImage = GetSpriteImage(renderableObject);
            var picBox      = new CustomPictureBox
            {
                BackColor = Color.Transparent,
                Image     = spriteImage,
                Location  = new Point(renderableObject.X, renderableObject.Y),
                Size      = new Size(renderableObject.SizeX, renderableObject.SizeY),
                Parent    = this.gameWindow,
                Tag       = new CustomPicBoxTag(renderableObject, this.Controller)
            };

            this.pictureBoxes.Add(picBox);
            this.gameWindow.Controls.Add(picBox);
        }