这几天学习C#.net,自己做了一个简单的图片浏览器,但是就是有一些异常的错误,我就不知道怎么处理了,现在我把程序及其窗体贴出来,大家指点一下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace No._6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void btn1_Click(object sender, EventArgs e)
{
string str;
openFileDialog1.Filter = "*.jpg,*.jpeg|*.jpg";
openFileDialog1.ShowDialog();
str = openFileDialog1.FileName;
pictureBox1.Image = Image.FromFile(str);
} private void btn2_Click(object sender, EventArgs e)
{
pictureBox1.Width = Convert.ToInt32(pictureBox1.Width*1.2);
pictureBox1.Height = Convert.ToInt32(pictureBox1.Height * 1.2);
} private void btn3_Click(object sender, EventArgs e)
{
pictureBox1.Width = Convert.ToInt32(pictureBox1.Width * 0.8);
pictureBox1.Height = Convert.ToInt32(pictureBox1.Height * 0.8);
} private void btn4_Click(object sender, EventArgs e)
{
Image myi = pictureBox1.Image;
myi.RotateFlip(RotateFlipType.Rotate180FlipY);
pictureBox1.Image = myi;
} private void btn5_Click(object sender, EventArgs e)
{
Image myi = pictureBox1.Image;
myi.RotateFlip(RotateFlipType.Rotate180FlipX);
pictureBox1.Image = myi;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace No._6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void btn1_Click(object sender, EventArgs e)
{
string str;
openFileDialog1.Filter = "*.jpg,*.jpeg|*.jpg";
openFileDialog1.ShowDialog();
str = openFileDialog1.FileName;
pictureBox1.Image = Image.FromFile(str);
} private void btn2_Click(object sender, EventArgs e)
{
pictureBox1.Width = Convert.ToInt32(pictureBox1.Width*1.2);
pictureBox1.Height = Convert.ToInt32(pictureBox1.Height * 1.2);
} private void btn3_Click(object sender, EventArgs e)
{
pictureBox1.Width = Convert.ToInt32(pictureBox1.Width * 0.8);
pictureBox1.Height = Convert.ToInt32(pictureBox1.Height * 0.8);
} private void btn4_Click(object sender, EventArgs e)
{
Image myi = pictureBox1.Image;
myi.RotateFlip(RotateFlipType.Rotate180FlipY);
pictureBox1.Image = myi;
} private void btn5_Click(object sender, EventArgs e)
{
Image myi = pictureBox1.Image;
myi.RotateFlip(RotateFlipType.Rotate180FlipX);
pictureBox1.Image = myi;
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货