Beispiel #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (_projectileData != null)
            {
                Rectangle dest;
                if (_iconSheetImage != null)
                {
                    Rectangle src = new Rectangle((_projectileData.IconID % 8) * 32, (_projectileData.IconID / 8) * 32, 32, 32);
                    dest = new Rectangle(0, 0, 32, 32);
                    e.Graphics.DrawImage(_iconSheetImage, dest, src, GraphicsUnit.Pixel);

                    Point anchor = _editorForm.GetProjectilelAnchor();
                    Point bounds = _editorForm.GetProjectileBounds();
                    dest = new Rectangle(anchor.X - 1, anchor.Y - 1, 2, 2);
                    e.Graphics.FillRectangle(new SolidBrush(Color.Red), dest);
                    dest = new Rectangle(anchor.X - (bounds.X / 2), anchor.Y - (bounds.Y / 2), bounds.X, bounds.Y);
                    e.Graphics.DrawRectangle(new Pen(Color.Red, 2), dest);
                }
            }
        }