C#:水平翻转图片 [英] C#: Flip image horizontally

查看:571
本文介绍了C#:水平翻转图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是,在单选按钮,单击水平翻转图像。

What I'm trying to do is, to flip image horizontally on radio button click.

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
    arrow.Image.RotateFlip(RotateFlipType.RotateNoneFlipX);
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
    arrow.Image.RotateFlip(RotateFlipType.RotateNoneFlipX);
}



上面的代码不翻转图片:图片保持原样。我缺少什么?

The code above doesn't flip image: image stays as it is. What am I missing?

推荐答案

您需要以使其重绘,您可以通过执行

You need to cause it to redraw, you can force this manually by doing

 private void radioButton1_CheckedChanged(object sender, EventArgs e)
 {
     arrow.Image.RotateFlip(RotateFlipType.RotateNoneFlipX);
     arrow.Invalidate() ;
 }

您也应该只有这对单选按钮,而不是两者之一,否则,他们会相互抵消,因此,与上述替换当前的东西。只是验证它工作在VS2005,没有VS2010方便

You should also only have this on one of the radio buttons, not both, otherwise they'll negate each other, so replace your current stuff with the above. Just verified it works under vs2005, don't have vs2010 handy

这篇关于C#:水平翻转图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆