You are on page 1of 4

EXPERIMENT NO.

11

Aim: Design a form using picture box and timer control to rotate the picture after specific
interval.

Course Outcome Achieved:


• Use different object tools to develop simple GUI applications.

Practical outcomes achieved: Design a form using picture box and timer control to rotate the
picture after specific interval.

Apparatus:

Serial
Product Specification Quantity
number

Any desktop or pc with basic


01. Desktop/PC 01
configuration

02. Visual Studio Community Version 2022 01

Theory:
Picture Box: Picture Box control is used to display the images on Windows Form. The Picture
Box control has an image property that allows the user to set the image at runtime or design time.
Let's create a Picture Box control in the VB.NET Windows form using the following steps.
Step 1: We must find the Picture Box control from the toolbox and then drag and drop the
Picture Box control onto the window form, as shown below.
Step 2: Once the Picture Box is added to the form, we can set various properties of the image by
clicking on the Picture Box control.

Timer Control: The timer control is a looping control used to repeat any task in each time
interval. It is an important control used in Client-side and Server-side programming, also in
Windows Services.
Furthermore, if we want to execute an application after a specific amount of time, we can use
Timer Control. Once the timer is enabled, it generates a tick event handler to perform any
defined task in its time interval property. It starts when the start () method of timer control is
called, and it repeats the defined task continuously until the timer stops.

Code:
using System.Diagnostics.Eventing.Reader;
namespace Exp_11
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
}
private void button1_Click(object sender, EventArgs e)
{
if (timer1.Enabled == false)
{
timer1.Enabled = true;
}
else
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (pictureBox1.Left < this.Width)
{
//a=(int)conversion.Int(If+VB math.Rnd()*3f);
pictureBox1.Left = pictureBox1.Width + 50;
//picture1.Location.X=a;
}
else
pictureBox1.Left = 0;
}
}
}
Output:

Conclusion:
Thus, we designed a form using picture box and timer control to rotate the picture after specific
interval.

Marks obtained Dated signature of


teacher
Process Related Product Related Total (25)
(15) (10)

You might also like