diff options
| author | AShifter <[email protected]> | 2017-03-26 11:28:05 -0600 |
|---|---|---|
| committer | AShifter <[email protected]> | 2017-03-26 11:28:24 -0600 |
| commit | f16f3a8a3df33f46c4ec6c864447cced97c0f034 (patch) | |
| tree | 6c06d045bd7afa16c89b63c01c41b2ace019ff8b /TimeHACK.Engine | |
| parent | a7128e18c33b39b6253f9af3022fb1a47b1ac5f1 (diff) | |
| download | histacom2-f16f3a8a3df33f46c4ec6c864447cced97c0f034.tar.gz histacom2-f16f3a8a3df33f46c4ec6c864447cced97c0f034.tar.bz2 histacom2-f16f3a8a3df33f46c4ec6c864447cced97c0f034.zip | |
Finished WindowManager.cs
I HOPE YOU LIKE IT HONEYFRY
Diffstat (limited to 'TimeHACK.Engine')
16 files changed, 130 insertions, 26 deletions
diff --git a/TimeHACK.Engine/Properties/Resources.Designer.cs b/TimeHACK.Engine/Properties/Resources.Designer.cs index de94a30..a5a90ba 100644 --- a/TimeHACK.Engine/Properties/Resources.Designer.cs +++ b/TimeHACK.Engine/Properties/Resources.Designer.cs @@ -103,6 +103,16 @@ namespace TimeHACK.Engine.Properties { /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> + internal static System.Drawing.Bitmap nullIcon { + get { + object obj = ResourceManager.GetObject("nullIcon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> internal static System.Drawing.Bitmap RightSide { get { object obj = ResourceManager.GetObject("RightSide", resourceCulture); diff --git a/TimeHACK.Engine/Properties/Resources.resx b/TimeHACK.Engine/Properties/Resources.resx index f63b0e2..ff58fbd 100644 --- a/TimeHACK.Engine/Properties/Resources.resx +++ b/TimeHACK.Engine/Properties/Resources.resx @@ -130,6 +130,9 @@ <data name="LeftSide" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\resources\winclassic\window\leftside.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="nullIcon" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\resources\winclassic\window\nullicon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> <data name="RightSide" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\resources\winclassic\window\rightside.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> diff --git a/TimeHACK.Engine/Resources/WinClassic/Window/nullIcon.png b/TimeHACK.Engine/Resources/WinClassic/Window/nullIcon.png Binary files differnew file mode 100644 index 0000000..a8bbc1d --- /dev/null +++ b/TimeHACK.Engine/Resources/WinClassic/Window/nullIcon.png diff --git a/TimeHACK.Engine/Resources/WinClassic/desktop.ini b/TimeHACK.Engine/Resources/WinClassic/desktop.ini deleted file mode 100644 index 00ae697..0000000 --- a/TimeHACK.Engine/Resources/WinClassic/desktop.ini +++ /dev/null @@ -1,3 +0,0 @@ -[LocalizedFileNames] -settings pic start.png=@settings pic start.png,0 -windows 95 sidemenustart.bmp=@windows 95 sidemenustart.bmp,0 diff --git a/TimeHACK.Engine/Template/WinClassic.Designer.cs b/TimeHACK.Engine/Template/WinClassic.Designer.cs index 7df96b7..6fc4a78 100644 --- a/TimeHACK.Engine/Template/WinClassic.Designer.cs +++ b/TimeHACK.Engine/Template/WinClassic.Designer.cs @@ -44,11 +44,13 @@ this.bottom = new System.Windows.Forms.Panel(); this.right = new System.Windows.Forms.Panel(); this.top = new System.Windows.Forms.Panel(); + this.programIcon = new System.Windows.Forms.PictureBox(); this.program.SuspendLayout(); this.programtopbar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.maximizebutton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.minimizebutton)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.closebutton)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.programIcon)).BeginInit(); this.SuspendLayout(); // // program @@ -81,6 +83,7 @@ // programtopbar // this.programtopbar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(170))))); + this.programtopbar.Controls.Add(this.programIcon); this.programtopbar.Controls.Add(this.maximizebutton); this.programtopbar.Controls.Add(this.minimizebutton); this.programtopbar.Controls.Add(this.Title); @@ -90,6 +93,7 @@ this.programtopbar.Name = "programtopbar"; this.programtopbar.Size = new System.Drawing.Size(292, 18); this.programtopbar.TabIndex = 0; + this.programtopbar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.programtopbar_drag); // // maximizebutton // @@ -100,6 +104,7 @@ this.maximizebutton.Size = new System.Drawing.Size(16, 14); this.maximizebutton.TabIndex = 6; this.maximizebutton.TabStop = false; + this.maximizebutton.Click += new System.EventHandler(this.maximizebutton_Click); // // minimizebutton // @@ -116,7 +121,7 @@ this.Title.AutoSize = true; this.Title.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Title.ForeColor = System.Drawing.Color.White; - this.Title.Location = new System.Drawing.Point(3, 2); + this.Title.Location = new System.Drawing.Point(23, 3); this.Title.Name = "Title"; this.Title.Size = new System.Drawing.Size(99, 13); this.Title.TabIndex = 3; @@ -131,6 +136,7 @@ this.closebutton.Size = new System.Drawing.Size(16, 14); this.closebutton.TabIndex = 4; this.closebutton.TabStop = false; + this.closebutton.Click += new System.EventHandler(this.closebutton_Click); // // toprightcorner // @@ -208,6 +214,17 @@ this.top.Size = new System.Drawing.Size(300, 4); this.top.TabIndex = 8; // + // programIcon + // + this.programIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.programIcon.ErrorImage = null; + this.programIcon.InitialImage = null; + this.programIcon.Location = new System.Drawing.Point(2, 1); + this.programIcon.Name = "programIcon"; + this.programIcon.Size = new System.Drawing.Size(16, 16); + this.programIcon.TabIndex = 0; + this.programIcon.TabStop = false; + // // WinClassic // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -223,6 +240,7 @@ ((System.ComponentModel.ISupportInitialize)(this.maximizebutton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.minimizebutton)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.closebutton)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.programIcon)).EndInit(); this.ResumeLayout(false); } @@ -230,10 +248,7 @@ #endregion internal System.Windows.Forms.Panel program; - private System.Windows.Forms.Panel programContent; internal System.Windows.Forms.Panel programtopbar; - internal System.Windows.Forms.PictureBox maximizebutton; - internal System.Windows.Forms.PictureBox minimizebutton; internal System.Windows.Forms.Label Title; internal System.Windows.Forms.PictureBox closebutton; internal System.Windows.Forms.Panel toprightcorner; @@ -244,5 +259,9 @@ internal System.Windows.Forms.Panel bottom; internal System.Windows.Forms.Panel right; internal System.Windows.Forms.Panel top; + public System.Windows.Forms.Panel programContent; + public System.Windows.Forms.PictureBox maximizebutton; + public System.Windows.Forms.PictureBox minimizebutton; + public System.Windows.Forms.PictureBox programIcon; } }
\ No newline at end of file diff --git a/TimeHACK.Engine/Template/WinClassic.cs b/TimeHACK.Engine/Template/WinClassic.cs index aa72263..1bd11e3 100644 --- a/TimeHACK.Engine/Template/WinClassic.cs +++ b/TimeHACK.Engine/Template/WinClassic.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace TimeHACK.Engine.Template @@ -16,5 +10,63 @@ namespace TimeHACK.Engine.Template { InitializeComponent(); } + + public const int WM_NCLBUTTONDOWN = 0xA1; + public const int HT_CAPTION = 0x2; + + [DllImportAttribute("user32.dll")] + public static extern int SendMessage(IntPtr hWnd, + int Msg, int wParam, int lParam); + [DllImportAttribute("user32.dll")] + public static extern bool ReleaseCapture(); + + private void programtopbar_drag(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + ReleaseCapture(); + SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); + } + } + + private void closebutton_Click(object sender, EventArgs e) + { + this.Close(); + } + + public Boolean max = false; + + private void maximizebutton_Click(object sender, EventArgs e) + { + if (max == false) + { + this.right.Hide(); + this.left.Hide(); + this.bottom.Hide(); + this.top.Hide(); + this.bottomleftcorner.Hide(); + this.bottomrightcorner.Hide(); + this.topleftcorner.Hide(); + this.toprightcorner.Hide(); + this.Dock = DockStyle.Fill; + max = true; + maximizebutton.Image = Properties.Resources.WinClassicRestore; + } + else + { + this.right.Show(); + this.left.Show(); + this.bottom.Show(); + this.top.Show(); + this.bottomleftcorner.Show(); + this.bottomrightcorner.Show(); + this.topleftcorner.Show(); + this.toprightcorner.Show(); + this.Dock = DockStyle.None; + max = false; + maximizebutton.Image = Properties.Resources.WinClassicMax; + } + + } } } diff --git a/TimeHACK.Engine/TimeHACK.Engine.csproj b/TimeHACK.Engine/TimeHACK.Engine.csproj index c691b41..840be1f 100644 --- a/TimeHACK.Engine/TimeHACK.Engine.csproj +++ b/TimeHACK.Engine/TimeHACK.Engine.csproj @@ -71,6 +71,7 @@ <Content Include="Resources\WinClassic\Window\BottomRight.png" /> <Content Include="Resources\WinClassic\Window\BottomSide.png" /> <Content Include="Resources\WinClassic\Window\LeftSide.png" /> + <Content Include="Resources\WinClassic\Window\nullIcon.png" /> <Content Include="Resources\WinClassic\Window\RightSide.png" /> <Content Include="Resources\WinClassic\Window\TopLeft.png" /> <Content Include="Resources\WinClassic\Window\TopRight.png" /> @@ -80,8 +81,6 @@ <Content Include="Resources\WinClassic\Window\WinClassicMin.png" /> <Content Include="Resources\WinClassic\Window\WinClassicRestore.png" /> </ItemGroup> - <ItemGroup> - <Folder Include="NewFolder1\" /> - </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/TimeHACK.Engine/WindowManager.cs b/TimeHACK.Engine/WindowManager.cs index 540dddd..fc9bd94 100644 --- a/TimeHACK.Engine/WindowManager.cs +++ b/TimeHACK.Engine/WindowManager.cs @@ -1,20 +1,44 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using TimeHACK.Engine.Template; +using System.Windows.Forms; namespace TimeHACK.Engine { - class WindowManager + public class WindowManager { - private void startWinClassic(String title, int width, int height) + 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 = width + 8; - app.Height = height + 26; + 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 + if (MaxButton == false) + { + app.maximizebutton.Visible = false; + } + + // Check if Min button is enabled + if (MinButton == false) + { + app.minimizebutton.Visible = false; + } + + // Show the app + app.Show(); + + } } -} +}
\ No newline at end of file diff --git a/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.dll b/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.dll Binary files differindex 9c859e2..9e8c504 100644 --- a/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.dll +++ b/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.dll diff --git a/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.pdb b/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.pdb Binary files differindex a92c614..b0d17dc 100644 --- a/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.pdb +++ b/TimeHACK.Engine/bin/Debug/TimeHACK.Engine.pdb diff --git a/TimeHACK.Engine/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/TimeHACK.Engine/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache Binary files differindex 2bcd07c..6e8cfad 100644 --- a/TimeHACK.Engine/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +++ b/TimeHACK.Engine/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache diff --git a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.Properties.Resources.resources b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.Properties.Resources.resources Binary files differindex f78bd37..9629cd7 100644 --- a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.Properties.Resources.resources +++ b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.Properties.Resources.resources diff --git a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csproj.GenerateResource.Cache b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csproj.GenerateResource.Cache Binary files differindex 13bac28..360f1c8 100644 --- a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csproj.GenerateResource.Cache +++ b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csproj.GenerateResource.Cache diff --git a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csprojResolveAssemblyReference.cache b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csprojResolveAssemblyReference.cache Binary files differindex d835909..1de83d9 100644 --- a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csprojResolveAssemblyReference.cache +++ b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.csprojResolveAssemblyReference.cache diff --git a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.dll b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.dll Binary files differindex 9c859e2..9e8c504 100644 --- a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.dll +++ b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.dll diff --git a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.pdb b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.pdb Binary files differindex a92c614..b0d17dc 100644 --- a/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.pdb +++ b/TimeHACK.Engine/obj/Debug/TimeHACK.Engine.pdb |
