我只有一个按钮应该做的事情,但当我按下它没有任何反应?我知道这只是一个小错误,我现在看不到可能有人可以帮助我吗?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private string ConvertImage(Bitmap sBit)
{
MemoryStream imageStream = new MemoryStream();
sBit.Save(imageStream, ImageFormat.Jpeg);
return Convert.ToBase64String(imageStream.ToArray());
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap sBit = new Bitmap(@"C:\12.jpg");
string imageString = ConvertImage(sBit);
StreamWriter sw = new StreamWriter(@"C:\12.text", false);
sw.Write(imageString);
sw.Close();
}
}
}