answersLogoWhite

0

Hello, this is the author posting... The problem is, that I need to set the sides of the Form as boundaries that picture boxes (that act as the paddles) cannot go past. IN OTHER WORDS: I need to block the PicBoxes from going out of view on the form.

Here's What I Got So Far:

using

System;

using

System.Collections.Generic;

using

System.ComponentModel;

using

System.Data;

using

System.Drawing;

using

System.Linq;

using

System.Text;

using

System.Windows.Forms;

namespace

Vong

{

public partial class frmVong : Form

{

public frmVong()

{

InitializeComponent();

KeyDown +=

new KeyEventHandler(Form1_KeyDown);

}

void Form1_KeyDown(object sender, KeyEventArgs e)

{

int x1 = picPlayer1.Location.X;

int y1 = picPlayer1.Location.Y;

int x2 = picPlayer2.Location.X;

int y2 = picPlayer2.Location.Y;

if (e.KeyCode Keys.Down)

y2 += 50;

picPlayer2.Location =

new Point(x2, y2);

}

}

}

User Avatar

Wiki User

13y ago

What else can I help you with?