private Point offset = new Point ( - 10 , 23 );
private void timer1_Tick( object sender , EventArgs e)
{
if ((offset . X + pictureBox1 . Left < 0 ) ||
(offset . X + pictureBox1 . Left + pictureBox1 . Width > ClientSize . Width))
offset . X = - offset . X;
if ((offset . Y + pictureBox1 . Top < 0 ) ||
(offset . Y + pictureBox1 . Top + pictureBox1 . Height > ClientSize . Height))
offset . Y = - offset . Y;
pictureBox1 . Left = Math . Min(pictureBox1 . Left + offset . X,
ClientSize . Width - pictureBox1 . Width);
pictureBox1 . Top = Math . Min(pictureBox1 . Top + offset . Y,
ClientSize . Height - pictureBox1 . Height);
}