using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WFrom { public partial class Form1 : Form { public string v_form1的值A = ""; public string v_form1的值B = ""; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //动态gif保存为动态jpg Image.FromFile(@"E:/000.bmp").Save("E://000.jpg"); //动态gif保存为静态jpg Bitmap bitmap = new Bitmap("E://000.bmp"); bitmap.Save("E://000.bmp.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); string v1 = "E://000.gif"; if (v1.EndsWith(".gif") || v1.EndsWith(".GIF") || v1.EndsWith(".bmp") || v1.EndsWith(".BMP")) { Bitmap bitmap = new Bitmap(v1); v1 = v1.Substring(0, v1.Length - 4) + ".jpg"; bitmap.Save(v1, System.Drawing.Imaging.ImageFormat.Jpeg); } } private void button1_Click(object sender, EventArgs e) { MessageBox.Show(v_form1的值A); MessageBox.Show(v_form1的值B); } } }