110,567
社区成员
发帖
与我相关
我的任务
分享
Image image1 = (Image)_image.Clone();
if (this.pictureBox1.Image != null)
{
this.pictureBox1.Image.Dispose();
this.pictureBox1.Image = null;
}
this.pictureBox1.Image = image1;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Control.CheckForIllegalCrossThreadCalls = false;
Thread myThread = new Thread(new ParameterizedThreadStart(ImageSet));
myThread.Start(Image.FromFile(@"C:\Users\hi\Desktop\1.bmp"));
}
public void ImageSet(object imageObj)
{
Image image = imageObj as Image;
while (true)
{
if (pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
pictureBox1.Image = null;
}
pictureBox1.Image = (Image)image.Clone();
Thread.Sleep(200);
}
}
}
}
我这边是闹鬼了吗!if (this.pictureBox1.Image != null)
{
this.pictureBox1.Image.Dispose();
this.pictureBox1.Image = null;
}
public void ImageSet(Image image)
{
if (image == null)
{
return;
}
try
{
this.TopMost = true;
this.Show();
this.BringToFront();
while (true)
{
if (this.pictureBox1.Image != null)
{
this.pictureBox1.Image.Dispose();
this.pictureBox1.Image = null;
}
this.pictureBox1.Image = (Image)image.Clone();
}
}
catch (Exception err)
{
this.Close();
}
}