I am having a problem while scrolling a panel across a window form.I added a panel to the form.then i set the Background image and the back ground image layout to stretch.
Then i added a timer to the form and wrote the following in the code behind
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
namespace
WindowsApplication23
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
private void Form1_Load(object sender, EventArgs e)
{
panel1.Location =
new Point(0, 30);
timer1.Interval =100;
timer1.Enabled =
true;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
int newPoint = panel1.Location.X + 2;
panel1.Location =
new Point(newPoint, 30);
if (panel1.Location.X > this.Width)
{
panel1.Dispose();
timer1.Stop();
MessageBox.Show("Ta ta");
return;
}
}
}
}
The problem is while the panel moves the scrolling is not smooth.Seems to have flickering,some sort of a difficulty in moving
Please do help me out