I created a local folder within the project named 'Assets' with .ico and .png icons of the program, when I assign a local file icon to the tray icon placed in the Windows Forms window and publish the project as executable, the folder and the icon file are hidden in the compiled program folder, but if I create the tray icon like this:
public void Init()
{
string ?Base_path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
try
{
if (Base_path != null && Base_path != "")
{
Ico_path = Path.Combine(Base_path, "Assets", "ico", "16x.ico");
}
else
{
Ico_path = Path.Combine(AppContext.BaseDirectory, "Assets", "ico", "16x.ico");
}
SpawnTray(Ico_path);
}
catch (Exception ex)
{
MsgClass.Init(ex.Message, MessageBoxIcon.Error);
System.Environment.Exit(1);
}
}
private void SpawnTray(string ico_path)
{
Icon_x = new NotifyIcon();
Icon_x.Icon = new Icon(ico_path);
Icon_x.Visible = true;
}
Folder and icon appear (normally ok). So how do I copy the way the Windows Form Application engine imports media files like images, uses and hides it in the compiled program for the end user?