Skip to content

Commit

Permalink
Made icons of forms loadable from Application.StartupPath.
Browse files Browse the repository at this point in the history
Picture of frmAutor also loadable.
frmHelp shows error message if Help.rtf isn't found.
Created IconExtension.cs to load Keppler Icon.
Deleted unused usings.
  • Loading branch information
KepplerSystems committed Nov 7, 2016
1 parent 492ac65 commit de3a58a
Show file tree
Hide file tree
Showing 22 changed files with 79 additions and 1,902 deletions.
12 changes: 12 additions & 0 deletions B_ESA_4/B_ESA_4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Common\CommonConstants.cs" />
<Compile Include="Common\IconExtension.cs" />
<Compile Include="DataLoader.cs" />
<Compile Include="Forms\frmAutor.cs">
<SubType>Form</SubType>
Expand Down Expand Up @@ -150,6 +151,17 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="Impressum.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="K.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="SloganMitIconTransparentCCD - ohne we%27re.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
10 changes: 2 additions & 8 deletions B_ESA_4/Common/CommonConstants.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B_ESA_4.Common
namespace B_ESA_4.Common
{
public static class CommonConstants
{
public const int ONE_SECOND = 1000;
public const string Sign = "@";
public const string ItemSign = "o";
public const string Wall = "#";
public const string Point = ".";
public const string Point = ".";
}
}
20 changes: 20 additions & 0 deletions B_ESA_4/Common/IconExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Drawing;
using System.IO;

namespace B_ESA_4.Common
{
public static class IconExtension
{
const string K_ICON = "K.ico";

public static Icon GetKepplerIcon(this Icon icon, string startUpPath)
{
string iconFile = startUpPath + "\\" + K_ICON;
if (File.Exists(iconFile))
{
return new Icon(iconFile);
}
return icon;
}
}
}
4 changes: 0 additions & 4 deletions B_ESA_4/DataLoader.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B_ESA_4
{
Expand Down
5 changes: 1 addition & 4 deletions B_ESA_4/Forms/frmAutor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 20 additions & 6 deletions B_ESA_4/Forms/frmAutor.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using B_ESA_4.Common;
using System.IO;

namespace B_ESA_4.Forms
{
Expand All @@ -16,5 +12,23 @@ public frmAutor()
{
InitializeComponent();
}

private void frmAutor_Load(object sender, EventArgs e)
{
this.Icon = Icon.GetKepplerIcon(Application.StartupPath);

string impressum = Application.StartupPath + "\\Impressum.png";
string slogan = Application.StartupPath + "\\SloganMitIconTransparentCCD - ohne we're.png";

if (File.Exists(impressum))
{
pictureBox1.Image = Image.FromFile(impressum);
}

if (File.Exists(slogan))
{
pictureBox2.Image = Image.FromFile(slogan);
}
}
}
}
Loading

0 comments on commit de3a58a

Please sign in to comment.