How can i display images continuously without my interaction?

M

Mamatha

Hi

I am developing a small application to capture a record a video file
through webcam in C#.NET.
In this application i created a JPEG images for every slide,means every JPEG
image was treated as a slide then i want to display these images as a slide
show.
How can i alot time teo each frame?
How can i display images one by one without my interaction?
Please give me the solution or any releated source code.
Thanks in advance.

Mamatha
 
D

Damien Sawyer

Hi,

This might help.

1/ Put a "timer" control on your form (I assume that you're using a form?)
2/ Set the interval (it's in milliseconds)
3/ Set Enabled = true
4/ Handle the 'tick' event. This fires every time the timer passes the
interval. In this tick event, change the picture that you're displaying.

With regards to displaying the picture, I haven't included it in the code
example... I assume that you'd just use a picturebox control.

I have included a code sample which puts a textbox on a form and increments
a counter on it every second.

Hope that this helps,


Damien Sawyer



-----------
using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

namespace csharpTimer

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.Windows.Forms.Label label1;

private System.ComponentModel.IContainer components;

private short i = 0;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();


}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.label1 = new System.Windows.Forms.Label();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// label1

//

this.label1.Location = new System.Drawing.Point(24, 48);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(168, 16);

this.label1.TabIndex = 0;

this.label1.Text = "0";

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(292, 266);

this.Controls.Add(this.label1);

this.Name = "Form1";

this.Text = "Form1";

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void timer1_Tick(object sender, System.EventArgs e)

{

i++;

this.label1.Text = i.ToString();

}

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top