3
I am developing a C# application and would like to know how to freely rotate a bitmap which is drawn in a pictureBox without rotating all _pictureBox_e so that the bitmap Rotacione around its own center. Follow my last attempt:
Bitmap irisref1;
private void pcbREFOLHOS_Paint(object sender, PaintEventArgs e)
{
e.Graphics.TranslateTransform(pcbREFOLHOS.Width / 2, pcbREFOLHOS.Height / 2);
e.Graphics.RotateTransform(contador);
e.Graphics.DrawImage(irisref1, new PointF((5 - atualdata1 - 2.5f) * 10, 0));
contador++;
//e.Graphics.DrawEllipse(new Pen(Color.White, 3), 0, 0, 150, 60);
}
In this way I did not obtain the expected result, because the image "orbits" around the specified point, but I would like the image to rotate around its own center. Can anyone help with this problem?
Thanks friend, it worked very well, however the image according to the runtime will overshadow. I am not able to stop it.
– Felipe Mateus
Strange, I was not aware of this "consequence". But this code doesn’t seem to me to be causing it... it has some code other than this to treat the image?
– João Martins
No, only the "pcbREFOLHOS Paint event".
– Felipe Mateus
And you still need this event? You can delete the content, right?
– João Martins
I was using the Paint event because the image will be rotating during the run time.
– Felipe Mateus
I tried to add a timer, to rotate and give "Invalidate()".
– Felipe Mateus
According to the indications on this issue of Soen Image in Picturebox Become Blurry While Rotating, should always use the original image, only changing the cumulative rotation. The Blur is due to an unavoidable effect of the rotation.
– João Martins
Now yes, 100% friend, thank you very much!!
– Felipe Mateus