C# 图像浏览器问题
高手请看下为什么在pictureBox1.Load这说没有定义LoadstaticvoidMain(){Application.Run(newmainform());}p...
高手请看下为什么在pictureBox1.Load这说没有定义Load
static void Main()
{
Application.Run(new mainform());
}
private ArrayList arrPath = new ArrayList();
private int index =-1;
private void mainform_Load(object sender, System.EventArgs e)
{
openFileDialog1.Multiselect=true;
openFileDialog1.Filter="图像文件(*.BMP;*.JPG;*.GIF;*.jpeg)|*.BMP;*.JPG;*.GIF;*.jpeg";
cbSizeMode.Items.Add(PictureBoxSizeMode.Normal);
cbSizeMode.Items.Add(PictureBoxSizeMode.StretchImage);
cbSizeMode.Items.Add(PictureBoxSizeMode.AutoSize);
cbSizeMode.Items.Add(PictureBoxSizeMode.AutoSize);
cbSizeMode.Items.Add(PictureBoxSizeMode.CenterImage);
cbSizeMode.Items.Add(System.Windows.Forms.PictureBoxSizeMode.Normal);
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Normal;
cbSizeMode.SelectedIndex=4;
timer1.Interval=2000;
}
private void btnopen_Click(object sender, System.EventArgs e)
{
if(openFileDialog1.ShowDialog()==DialogResult.OK)
{arrPath.Clear();
if(openFileDialog1.FileNames.Length!=0)
{
foreach(string s in openFileDialog1.FileNames)
{arrPath.Add(s);
}
index=0;
Image img = Image.FromFile(@"路径");
pictureBox1.Image=img;
}
}
}
private void btnperiod_Click(object sender, System.EventArgs e)
{
if(arrPath.Count!=0)
{index=(index==0)?(arrPath.Count-1):(--index);
pictureBox1.Load(arrPath[index].ToString());
}
}
private void btnnext_Click(object sender, System.EventArgs e)
{
if(arrPath.Count!=0)
{index=(index==arrPath.Count-1)?0:(++index);
pictureBox1.Load(arrPath[index].ToString());
}
}
private void cbsizemode_SelectedIndexChanged(object sender, System.EventArgs e)
{
pictureBox1.SizeMode=(PictureBoxSizeMode)cbSizeMode.SelectedItem;
}
private void timer1_Tick(object sender, System.EventArgs e)
{
if(arrPath.Count!=0)
{index=(index==arrPath.Count-1)?0:(++index);
pictureBox1.Load(arrPath[index].ToString());
}
}
private void chkautoplay_CheckedChanged(object sender, System.EventArgs e)
{
timer1.Enabled=chkautoplay.Checked;
} 展开
static void Main()
{
Application.Run(new mainform());
}
private ArrayList arrPath = new ArrayList();
private int index =-1;
private void mainform_Load(object sender, System.EventArgs e)
{
openFileDialog1.Multiselect=true;
openFileDialog1.Filter="图像文件(*.BMP;*.JPG;*.GIF;*.jpeg)|*.BMP;*.JPG;*.GIF;*.jpeg";
cbSizeMode.Items.Add(PictureBoxSizeMode.Normal);
cbSizeMode.Items.Add(PictureBoxSizeMode.StretchImage);
cbSizeMode.Items.Add(PictureBoxSizeMode.AutoSize);
cbSizeMode.Items.Add(PictureBoxSizeMode.AutoSize);
cbSizeMode.Items.Add(PictureBoxSizeMode.CenterImage);
cbSizeMode.Items.Add(System.Windows.Forms.PictureBoxSizeMode.Normal);
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Normal;
cbSizeMode.SelectedIndex=4;
timer1.Interval=2000;
}
private void btnopen_Click(object sender, System.EventArgs e)
{
if(openFileDialog1.ShowDialog()==DialogResult.OK)
{arrPath.Clear();
if(openFileDialog1.FileNames.Length!=0)
{
foreach(string s in openFileDialog1.FileNames)
{arrPath.Add(s);
}
index=0;
Image img = Image.FromFile(@"路径");
pictureBox1.Image=img;
}
}
}
private void btnperiod_Click(object sender, System.EventArgs e)
{
if(arrPath.Count!=0)
{index=(index==0)?(arrPath.Count-1):(--index);
pictureBox1.Load(arrPath[index].ToString());
}
}
private void btnnext_Click(object sender, System.EventArgs e)
{
if(arrPath.Count!=0)
{index=(index==arrPath.Count-1)?0:(++index);
pictureBox1.Load(arrPath[index].ToString());
}
}
private void cbsizemode_SelectedIndexChanged(object sender, System.EventArgs e)
{
pictureBox1.SizeMode=(PictureBoxSizeMode)cbSizeMode.SelectedItem;
}
private void timer1_Tick(object sender, System.EventArgs e)
{
if(arrPath.Count!=0)
{index=(index==arrPath.Count-1)?0:(++index);
pictureBox1.Load(arrPath[index].ToString());
}
}
private void chkautoplay_CheckedChanged(object sender, System.EventArgs e)
{
timer1.Enabled=chkautoplay.Checked;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询