162 lines
4.9 KiB
C#
162 lines
4.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace OwnForms
|
|
{
|
|
public partial class MyForm : Form
|
|
{
|
|
#region Version und Copyright
|
|
// Version und Copyright
|
|
string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
|
|
string programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
|
static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
|
string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
|
string icon = Application.StartupPath + "\\Info.bmp";
|
|
//Assembly Datum und Zeit
|
|
static DateTime value = AssemblyDateTime();
|
|
string date = value.ToShortDateString();
|
|
string time = value.ToLongTimeString();
|
|
private static DateTime AssemblyDateTime()
|
|
{
|
|
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
|
var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision));
|
|
//Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original)
|
|
return buildDateTime;
|
|
}
|
|
#endregion
|
|
|
|
#region Programm-Info
|
|
/// <summary>
|
|
/// Contains the name of the program file
|
|
/// </summary>
|
|
public static string ProgramName { set; get; }
|
|
|
|
/// <summary>
|
|
/// Contains the version of the program file
|
|
/// </summary>
|
|
public static string ProgramVersion { set; get; }
|
|
|
|
/// <summary>
|
|
/// Contains the copyright notice
|
|
/// </summary>
|
|
public static string Copyright { set; get; }
|
|
|
|
private void SetProgramInfo()
|
|
{
|
|
//Name, Version und Copyright setzen
|
|
ProgramName = programName;
|
|
ProgramVersion = programVersion;
|
|
Copyright = copyright;
|
|
}
|
|
#endregion
|
|
|
|
public MyForm()
|
|
{
|
|
SetProgramInfo(); //Name, Version und Copyright setzen
|
|
InitializeComponent();
|
|
|
|
var window = new Window();
|
|
//Fenstergröße setzen
|
|
window.SetWindowSize(OwnForms.Window.Size.Nano);
|
|
this.Size = new Size(window.CurrentWindowSizeValue[0], window.CurrentWindowSizeValue[1]);
|
|
}
|
|
|
|
public MyForm(string name)
|
|
{
|
|
SetProgramInfo(); //Name, Version und Copyright setzen
|
|
InitializeComponent();
|
|
|
|
var window = new Window();
|
|
//Fenstergröße setzen
|
|
window.SetWindowSize(OwnForms.Window.Size.Nano);
|
|
this.Size = new Size(window.CurrentWindowSizeValue[0], window.CurrentWindowSizeValue[1]);
|
|
|
|
this.Text = name;
|
|
}
|
|
|
|
public MyForm(string name, string text)
|
|
{
|
|
SetProgramInfo(); //Name, Version und Copyright setzen
|
|
InitializeComponent();
|
|
|
|
var window = new Window();
|
|
//Fenstergröße setzen
|
|
window.SetWindowSize(OwnForms.Window.Size.Nano);
|
|
this.Size = new Size(window.CurrentWindowSizeValue[0], window.CurrentWindowSizeValue[1]);
|
|
|
|
this.Text = name;
|
|
labelMyForm.Text = text;
|
|
}
|
|
|
|
public MyForm(Window.Size winSize, string name, string text)
|
|
{
|
|
SetProgramInfo(); //Name, Version und Copyright setzen
|
|
InitializeComponent();
|
|
|
|
var window = new Window();
|
|
//Fenstergröße setzen
|
|
window.SetWindowSize(winSize);
|
|
this.Size = new Size(window.CurrentWindowSizeValue[0], window.CurrentWindowSizeValue[1]);
|
|
|
|
this.Text = name;
|
|
labelMyForm.Text = text;
|
|
}
|
|
|
|
private void buttonOk_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
public class OwnMessageBox : Form
|
|
{
|
|
|
|
}
|
|
|
|
public class OwnAboutWindow : Form
|
|
{
|
|
|
|
}
|
|
|
|
public class OwnOutputWinwow : Form
|
|
{
|
|
|
|
}
|
|
|
|
public class OwnForm : Form
|
|
{
|
|
public static void Show()
|
|
{
|
|
var mf = new MyForm();
|
|
mf.ShowDialog();
|
|
}
|
|
|
|
public static void Show(string name)
|
|
{
|
|
var mf = new MyForm(name);
|
|
mf.ShowDialog();
|
|
}
|
|
|
|
public static void Show(string name, string text)
|
|
{
|
|
var mf = new MyForm(name, text);
|
|
mf.ShowDialog();
|
|
}
|
|
|
|
public static void Show(Window.Size winSize, string name, string text)
|
|
{
|
|
var mf = new MyForm(winSize, name, text);
|
|
mf.ShowDialog();
|
|
}
|
|
}
|
|
}
|