aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Engine/WindowManager.cs
blob: 52a74d1720714a11a9c8c3a4ad8acd3e1e0ef99b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using TimeHACK.Engine.Template;
using System.Windows.Forms;
using System.Drawing;

namespace TimeHACK.Engine
{
    public class WindowManager
    {
        public void startWinClassic(UserControl content, String title, PictureBox icon, Boolean MaxButton, Boolean MinButton)
        {
            // Setup Window
            WinClassic app = new WinClassic();
            app.Title.Text = title;
            app.Width = content.Width + 8;
            app.Height = content.Height + 26;
            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;

            // 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 - 16, 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);
            }

            // Show the app
            app.Show();


        }
    }
}