c#图像反转

来源:百度知道 编辑:UC知道 时间:2024/05/27 17:44:42
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Drawing.Imaging;
using System.Windows.Forms;

namespace WindowsFormsApplication30
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "BMP File(*bmp)|*.bmp|GIF File(*.gif)|*.gif";
if (ofd.ShowDialog() == DialogResult.OK)
{
Bitmap image = new Bitmap(ofd.FileName);
image.Save("SaveFile.bmp", ImageFormat.Bmp);
}

}

可以直接用 RotateFlip 方法进行翻转啊 ·
Bitmap box1 = new Bitmap(pictureBox1.Image);
box1.RotateFlip(RotateFlipType.Rotate180FlipX);
pictureBox1.Image = box1;
这样就能进行 180°的倒转了,当然RotateFlipType里面还有很的方法