mtsoft
سه شنبه 23 آبان 1391, 14:38 عصر
سلام خدمت همه دوستان عزیز
من با کد زیر یک تصویر رو می چرخونم و لی مشکل من اینه که تصویر از گوشه سمت چپ بالای می چرخه و من می خوام از نقطه دلخواه خودم مثلا مرکز تصویر بتنونم اون رو بچرخونم یا هر نقطه دیگه مثل عقربه های ساعت که تقریبا از تهشون یکم بالاتر می چرخن میشه من رو راهنمایی بفرمایید.
private void rotate(float daraje)
{
g = pictureBox1.CreateGraphics();
g.Clear(pictureBox1.BackColor);
g.TranslateTransform(pictureBox1.Width / 2, pictureBox1.Height / 2);
g.RotateTransform(daraje);
g.TranslateTransform(-pictureBox1.Width / 2, -pictureBox1.Height / 2);
g.DrawImage(Image.FromFile("1.png"), pictureBox1.Width / 2, pictureBox1.Height / 2);
g.Dispose();
}
من با کد زیر یک تصویر رو می چرخونم و لی مشکل من اینه که تصویر از گوشه سمت چپ بالای می چرخه و من می خوام از نقطه دلخواه خودم مثلا مرکز تصویر بتنونم اون رو بچرخونم یا هر نقطه دیگه مثل عقربه های ساعت که تقریبا از تهشون یکم بالاتر می چرخن میشه من رو راهنمایی بفرمایید.
private void rotate(float daraje)
{
g = pictureBox1.CreateGraphics();
g.Clear(pictureBox1.BackColor);
g.TranslateTransform(pictureBox1.Width / 2, pictureBox1.Height / 2);
g.RotateTransform(daraje);
g.TranslateTransform(-pictureBox1.Width / 2, -pictureBox1.Height / 2);
g.DrawImage(Image.FromFile("1.png"), pictureBox1.Width / 2, pictureBox1.Height / 2);
g.Dispose();
}