Answer the question
In order to leave comments, you need to log in
Why is the image blinking in the pictureBox?
If the mouse button is pressed and it moves, then a redraw occurs (there are only 2 lines), but when moving, the image blinks, and when the button is released, it disappears.
private void handleMouseMove(object sender, MouseEventArgs e)
{
int delta_x = this.pX - e.X;
int delta_y = this.pY - e.Y;
// move right
if (delta_x < 0 && this.clicked)
{
this.moveRight();
}
// move left
if (delta_x > 0 && this.clicked)
{
this.moveLeft();
}
// move top
if (delta_y > 0 && this.clicked)
{
this.moveTop();
}
// move bottom
if (delta_y < 0 && this.clicked)
{
this.moveBottom();
}
if (delta_y == 0 && delta_x == 0 && this.clicked)
{
this.disableMoving();
}
this.pX = e.X;
this.pY = e.Y;
if (this.clicked)
{
this.pictureBox.Invalidate();
this.draw();
}
}
Answer the question
In order to leave comments, you need to log in
Double buffering is not enabled, most likely, in addition, the image can be redrawn for a bunch of reasons, and the rendering mechanism / API for this is just ancient, you know what.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question