我不明白自己做错了什么,但是在尝试循环播放这些图片框创建时我遇到了这个错误。因此,我尝试使用try和catch来缩小范围,但我仍然不知道什么是错的?
private System.Windows.Forms.PictureBox[] imgVictim = new PictureBox[3]; //array for victim images
public void victimsRun()
{
victimTimer.Enabled = true; //starts the timer
PictureBox[] victim = new PictureBox[3];
for (int i = 0; i < imgVictim.Length; i++) // 0 - 2
{
try
{
imgVictim[i].Image = Image.FromFile("victim" + i.ToString() + ".png");
}
catch (NullReferenceException)
{
MessageBox.Show("NULL EXECEPTION!");
}
MessageBox.Show(i.ToString());
}
}
任何人都可以帮助我吗?
答案 0 :(得分:1)
您需要在使用之前创建每个PictureBox
x_compat=True
试试这个
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
dates = pd.date_range('20070101',periods=1000)
df = pd.DataFrame(np.random.randn(1000), index = dates, columns =list ('A'))
fig,ax = plt.subplots()
df.plot(x_compat=True,ax=ax)
ax.xaxis.set_tick_params(reset=True)
ax.xaxis.set_major_locator(mdates.YearLocator(1))
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y'))
plt.show()