2017-03-17 19:31:41 -04:00
|
|
|
|
using System;
|
2017-03-18 17:26:56 -04:00
|
|
|
|
using TimeHACK.Engine.Template;
|
2017-03-26 13:28:05 -04:00
|
|
|
|
using System.Windows.Forms;
|
2017-03-26 19:56:21 -04:00
|
|
|
|
using System.Drawing;
|
2017-03-17 19:31:41 -04:00
|
|
|
|
|
|
|
|
|
namespace TimeHACK.Engine
|
|
|
|
|
{
|
2017-03-26 13:28:05 -04:00
|
|
|
|
public class WindowManager
|
2017-03-17 19:31:41 -04:00
|
|
|
|
{
|
2017-03-27 17:42:35 -04:00
|
|
|
|
public WinClassic startWinClassic(UserControl content, String title, PictureBox icon, Boolean MaxButton, Boolean MinButton, Font fnt)
|
2017-03-17 19:31:41 -04:00
|
|
|
|
{
|
2017-03-26 13:28:05 -04:00
|
|
|
|
// Setup Window
|
2017-03-18 17:26:56 -04:00
|
|
|
|
WinClassic app = new WinClassic();
|
2017-03-27 15:32:59 -04:00
|
|
|
|
app.Text = title;
|
2017-03-18 17:26:56 -04:00
|
|
|
|
app.Title.Text = title;
|
2017-03-26 13:28:05 -04:00
|
|
|
|
app.Width = content.Width + 8;
|
|
|
|
|
app.Height = content.Height + 26;
|
2017-03-27 10:53:12 -04:00
|
|
|
|
app.fnt = fnt;
|
2017-03-26 13:28:05 -04:00
|
|
|
|
content.Parent = app.programContent;
|
|
|
|
|
content.BringToFront();
|
|
|
|
|
content.Dock = DockStyle.Fill;
|
|
|
|
|
if (icon == null)
|
|
|
|
|
{
|
|
|
|
|
icon = app.programIcon;
|
|
|
|
|
icon.Image = Properties.Resources.nullIcon;
|
|
|
|
|
}
|
|
|
|
|
app.programIcon.Image = icon.Image;
|
|
|
|
|
|
2017-03-26 19:56:21 -04:00
|
|
|
|
// Check if Max button is enabled and set proper X for Min button
|
2017-03-26 13:28:05 -04:00
|
|
|
|
if (MaxButton == false)
|
|
|
|
|
{
|
|
|
|
|
app.maximizebutton.Visible = false;
|
2017-03-27 15:32:59 -04:00
|
|
|
|
app.minimizebutton.Location = new Point(app.closebutton.Location.X - 14, app.minimizebutton.Location.Y);
|
2017-03-26 13:28:05 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if Min button is enabled
|
|
|
|
|
if (MinButton == false)
|
|
|
|
|
{
|
|
|
|
|
app.minimizebutton.Visible = false;
|
2017-03-26 19:56:21 -04:00
|
|
|
|
app.minimizebutton.Location = new Point(app.minimizebutton.Location.X, app.minimizebutton.Location.Y);
|
2017-03-26 13:28:05 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Show the app
|
|
|
|
|
app.Show();
|
2017-03-27 19:23:12 -04:00
|
|
|
|
app.BringToFront();
|
|
|
|
|
app.TopMost = true;
|
2017-03-26 13:28:05 -04:00
|
|
|
|
|
2017-03-27 17:42:35 -04:00
|
|
|
|
return app;
|
2017-03-17 19:31:41 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-26 13:28:05 -04:00
|
|
|
|
}
|