, Visual C#


         


// Form1
// DrawImage:
myGraphics.DrawImage(myBitmap,
Convert.ToInt32(position_of_ball_x -
width_of_bitmap_of_ball / 2),
Convert.ToInt32(position_of_ball_y -
height_of_bitmap_of_ball / 2),
width_of_bitmap_of_ball, height_of_bitmap_of_ball);
// , myGraphics:
myGraphics.Dispose();
//
//
// 'x' 'y':
position_of_ball_x = position_of_ball_x +
move_of_ball_x;
position_of_ball_y = position_of_ball_y +
move_of_ball_y;

// 'x',
// -
// :
if (position_of_ball_x + radius_of_ball_x >=
width_of_rectangle)
{
move_of_ball_x = -move_of_ball_x;
// Beep:
Microsoft.VisualBasic.Interaction.Beep();
}
if (position_of_ball_x - radius_of_ball_x <=
boundary_of_rectangle_x)
{
move_of_ball_x = -move_of_ball_x;
Microsoft.VisualBasic.Interaction.Beep();
}
// 'y',
// -
// :
if (position_of_ball_y + radius_of_ball_y >=
height_of_rectangle)
{
move_of_ball_y = -move_of_ball_y;
Microsoft.VisualBasic.Interaction.Beep();
}
if (position_of_ball_y - radius_of_ball_y <=