added try-catch and some error-logs for icon and logo loading
This commit is contained in:
1 parent
ea26bd20b0
commit
749432b976
1 file changed
+33
-4
+33
-4
@@ -172,11 +172,40 @@ namespace Vocaluxe
|
|||||||
{
|
{
|
||||||
public SplashScreen()
|
public SplashScreen()
|
||||||
{
|
{
|
||||||
Bitmap logo = new Bitmap(Path.Combine(Environment.CurrentDirectory, Path.Combine("Graphics", "logo.png")));
|
string path = Path.Combine(Environment.CurrentDirectory, Path.Combine("Graphics", "logo.png"));
|
||||||
this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Bitmap logo = new Bitmap(path);
|
||||||
|
this.ClientSize = new Size(logo.Width, logo.Height);
|
||||||
|
this.BackgroundImage = logo;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error loading logo: " + e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CLog.LogError("Can't find " + path);
|
||||||
|
|
||||||
|
path = Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon);
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.Icon = new System.Drawing.Icon(path);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error loading icon: " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
CLog.LogError("Can't find " + path);
|
||||||
|
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
this.ClientSize = new Size(logo.Width, logo.Height);
|
|
||||||
this.BackgroundImage = logo;
|
|
||||||
this.Text = CSettings.sProgramName;
|
this.Text = CSettings.sProgramName;
|
||||||
this.CenterToScreen();
|
this.CenterToScreen();
|
||||||
this.Show();
|
this.Show();
|
||||||
|
|||||||
Reference in new issue
Block a user