From 276de1e8c173e5d64e018f357d673aa1c9f1d1e3 Mon Sep 17 00:00:00 2001 From: szjay Date: Tue, 7 Jul 2020 10:06:52 +0800 Subject: [PATCH] --- MainUI/MainForm.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/MainUI/MainForm.cs b/MainUI/MainForm.cs index 90b0b9a..ff10c16 100644 --- a/MainUI/MainForm.cs +++ b/MainUI/MainForm.cs @@ -154,9 +154,19 @@ namespace Framework.MainUI AutoRunModule(); ApplicationLoader.RaiseMainFormShown(); - if (File.Exists("BackgroundImage.jpg")) + string backgroundImage = ""; + if (File.Exists(Path.Combine(ClientContext.ApplicationPath, "BackgroundImage.jpg"))) { - this.BackgroundImage = Image.FromFile("BackgroundImage.jpg"); + backgroundImage = Path.Combine(ClientContext.ApplicationPath, "BackgroundImage.jpg"); + } + else if (File.Exists(Path.Combine(ClientContext.ApplicationPath, "BackgroundImage.png"))) + { + backgroundImage = Path.Combine(ClientContext.ApplicationPath, "BackgroundImage.png"); + } + + if (!backgroundImage.IsNullOrEmpty()) + { + this.BackgroundImage = Image.FromFile(backgroundImage); this.BackgroundImageLayout = ImageLayout.Stretch; } -- GitLab