diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-10-24 11:27:51 +0100 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-10-24 11:27:51 +0100 |
| commit | 3d2e297b43cbd7f99269c9a58b25651a83ccef3c (patch) | |
| tree | ef636bc39af2b880af61acde98a2c5fb9e92cbaa /Histacom2.Engine/WindowManager.cs | |
| parent | e5f29e7b53322e11578acd0deb3b1d454998bb77 (diff) | |
| parent | aff052b475abc5d4035369a85fa471f62cad021b (diff) | |
| download | histacom2-3d2e297b43cbd7f99269c9a58b25651a83ccef3c.tar.gz histacom2-3d2e297b43cbd7f99269c9a58b25651a83ccef3c.tar.bz2 histacom2-3d2e297b43cbd7f99269c9a58b25651a83ccef3c.zip | |
Updated my fork!
Diffstat (limited to 'Histacom2.Engine/WindowManager.cs')
| -rw-r--r-- | Histacom2.Engine/WindowManager.cs | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/Histacom2.Engine/WindowManager.cs b/Histacom2.Engine/WindowManager.cs index 4f4951c..12f7954 100644 --- a/Histacom2.Engine/WindowManager.cs +++ b/Histacom2.Engine/WindowManager.cs @@ -36,11 +36,6 @@ namespace Histacom2.Engine app = new WinClassic(); break; } - case "XP": - { - // app = new WinXP(); - break; - } default: { app = new WinClassic(); @@ -111,9 +106,68 @@ namespace Histacom2.Engine return app; } - // A THING TM + public WinXP InitXP(UserControl content, string title, Image icon, bool MaxButton, bool MinButton, bool ShowApplicationAsDialog = false, bool resize = true) + { + WinXP app = new WinXP(); + + app.Text = title; + app.programname.Text = title; + app.Width = content.Width + 8; + app.Height = content.Height + 26; + // Initialize Font + pfc.AddFontFile(SaveSystem.GameDirectory + "\\Data\\LeviWindows.ttf"); + Font fnt = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0))); + app.fnt = fnt; + // Setup UC + content.Parent = app.flowLayoutPanel1; + content.BringToFront(); + content.Dock = DockStyle.Fill; + app.progContent = content; + + // Check if icon is null + if (icon == null) + { + app.programIcon.Hide(); + app.programIcon.Image = Engine.Properties.Resources.nullIcon; + app.programname.Location = new Point(2, 1); + } + else app.programIcon.Image = icon; + + // Check if Max button is enabled and set proper X for Min button + if (MaxButton == false) + { + app.maximizebutton.Visible = false; + app.minimizebutton.Location = new Point(app.closebutton.Location.X - 14, app.minimizebutton.Location.Y); + } + + // Check if Min button is enabled + if (MinButton == false) + { + app.minimizebutton.Visible = false; + app.minimizebutton.Location = new Point(app.minimizebutton.Location.X, app.minimizebutton.Location.Y); + } - // A THING TM + //Resize + app.resizable = resize; + + // Convert an image to an icon (for the taskbar) + if (icon != null) + { + Bitmap theBitmap = new Bitmap(icon, new Size(icon.Width, icon.Height)); + IntPtr Hicon = theBitmap.GetHicon(); // Get an Hicon for myBitmap. + Icon newIcon = Icon.FromHandle(Hicon); // Create a new icon from the handle. + app.Icon = newIcon; + } + + // Set some values (for the taskbar) + app.Tag = TaskBarController.AvalibleApplicationID; + app.Text = title; + + // Show the app + app.TopMost = true; + if (ShowApplicationAsDialog == false) { app.Show(); } else { app.ShowDialog(); } + return app; + } public WinClassic StartInfobox95(string title, string text, InfoboxType type, InfoboxButtons btns) { |
