C
cody
I have a slider in a dialog where the user can adjust the brightness of an
image. the problem is when the image is large the user cannot pull the
slider easily because everytime the slider changes its value the iamge has
to be recalculated. to disable this annoying behaviour I created an exra
thread with low priority to redraw the image. The problem know is that it is
still slow, if the image is very large one have to wait every millimeter the
slider is pulled.
// this starts my thread
thread = new Thread(new ThreadStart(Runner));
thread.Priority = ThreadPriority.Lowest;
thread.Start();
// this is my threadrunner:
void Runner()
{
lock (this)
{
while (true)
{
this.UpdateImage();
Monitor.Wait(this);
}
}
}
// this gets called when there is a valuechanged event in the slider:
void OnValuesChanged()
{
lock (this)
{
Monitor.Pulse(this);
}
}
Please help me with that! thx in advance!
image. the problem is when the image is large the user cannot pull the
slider easily because everytime the slider changes its value the iamge has
to be recalculated. to disable this annoying behaviour I created an exra
thread with low priority to redraw the image. The problem know is that it is
still slow, if the image is very large one have to wait every millimeter the
slider is pulled.
// this starts my thread
thread = new Thread(new ThreadStart(Runner));
thread.Priority = ThreadPriority.Lowest;
thread.Start();
// this is my threadrunner:
void Runner()
{
lock (this)
{
while (true)
{
this.UpdateImage();
Monitor.Wait(this);
}
}
}
// this gets called when there is a valuechanged event in the slider:
void OnValuesChanged()
{
lock (this)
{
Monitor.Pulse(this);
}
}
Please help me with that! thx in advance!