111,120
社区成员
发帖
与我相关
我的任务
分享
private void pictureBox1_Click(object sender, EventArgs e)
{
this.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Images\belle.png");
SaveBackrondImgePath(Application.StartupPath + @"\Images\belle.png");
}
private void SaveBackrondImgePath(string path)
{
backgroundPath = path;
File.WriteAllText(BACKGROUND_CONFIG, path);
}[code=csharp] private const string BACKGROUND_CONFIG = @".\background\path.txt";
private string backgroundPath = "";
private void Form1_Load(object sender, EventArgs e)
{
if (File.Exists(BACKGROUND_CONFIG))
{
backgroundPath = File.ReadAllText(BACKGROUND_CONFIG);
if (File.Exists(backgroundPath))
{
this.BackgroundImage = Image.FromFile(backgroundPath);
}
}
}[/code]