fix a few winxp template things

This commit is contained in:
lempamo 2017-10-23 16:49:06 -04:00
parent 5e91513731
commit fcab724a3d
3 changed files with 73 additions and 26 deletions

View file

@ -30,26 +30,26 @@ private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WinXP));
this.program = new System.Windows.Forms.Panel();
this.flowLayoutPanel1 = new System.Windows.Forms.Panel();
this.bottomleftcorner = new System.Windows.Forms.Panel();
this.toprightcorner = new System.Windows.Forms.Panel();
this.bottomrightcorner = new System.Windows.Forms.Panel();
this.topleftcorner = new System.Windows.Forms.Panel();
this.bottom = new System.Windows.Forms.Panel();
this.top = new System.Windows.Forms.Panel();
this.programIcon = new System.Windows.Forms.PictureBox();
this.maximizebutton = new System.Windows.Forms.PictureBox();
this.minimizebutton = new System.Windows.Forms.PictureBox();
this.programname = new System.Windows.Forms.Label();
this.closebutton = new System.Windows.Forms.PictureBox();
this.right = new System.Windows.Forms.Panel();
this.left = new System.Windows.Forms.Panel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.programIcon = new System.Windows.Forms.PictureBox();
this.program.SuspendLayout();
this.top.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.programIcon)).BeginInit();
((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
@ -70,6 +70,14 @@ private void InitializeComponent()
this.program.Size = new System.Drawing.Size(300, 300);
this.program.TabIndex = 10;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 30);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(292, 266);
this.flowLayoutPanel1.TabIndex = 11;
//
// bottomleftcorner
//
this.bottomleftcorner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@ -133,6 +141,18 @@ private void InitializeComponent()
this.top.Name = "top";
this.top.Size = new System.Drawing.Size(292, 30);
this.top.TabIndex = 0;
this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(this.top_MouseDown);
//
// programIcon
//
this.programIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.programIcon.ErrorImage = null;
this.programIcon.InitialImage = null;
this.programIcon.Location = new System.Drawing.Point(6, 7);
this.programIcon.Name = "programIcon";
this.programIcon.Size = new System.Drawing.Size(16, 16);
this.programIcon.TabIndex = 7;
this.programIcon.TabStop = false;
//
// maximizebutton
//
@ -165,6 +185,7 @@ private void InitializeComponent()
this.programname.Size = new System.Drawing.Size(99, 13);
this.programname.TabIndex = 3;
this.programname.Text = "Application Title";
this.programname.MouseDown += new System.Windows.Forms.MouseEventHandler(this.top_MouseDown);
//
// closebutton
//
@ -175,6 +196,7 @@ private void InitializeComponent()
this.closebutton.Size = new System.Drawing.Size(21, 21);
this.closebutton.TabIndex = 4;
this.closebutton.TabStop = false;
this.closebutton.Click += new System.EventHandler(this.closebutton_Click);
//
// right
//
@ -195,25 +217,6 @@ private void InitializeComponent()
this.left.Size = new System.Drawing.Size(4, 300);
this.left.TabIndex = 1;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 30);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(292, 266);
this.flowLayoutPanel1.TabIndex = 11;
//
// programIcon
//
this.programIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.programIcon.ErrorImage = null;
this.programIcon.InitialImage = null;
this.programIcon.Location = new System.Drawing.Point(6, 7);
this.programIcon.Name = "programIcon";
this.programIcon.Size = new System.Drawing.Size(16, 16);
this.programIcon.TabIndex = 7;
this.programIcon.TabStop = false;
//
// WinXP
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -227,10 +230,10 @@ private void InitializeComponent()
this.program.ResumeLayout(false);
this.top.ResumeLayout(false);
this.top.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.programIcon)).EndInit();
((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);
}
@ -250,7 +253,7 @@ private void InitializeComponent()
internal System.Windows.Forms.PictureBox closebutton;
internal System.Windows.Forms.Panel right;
internal System.Windows.Forms.Panel left;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
public System.Windows.Forms.PictureBox programIcon;
public System.Windows.Forms.Panel flowLayoutPanel1;
}
}

View file

@ -4,6 +4,7 @@
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -19,6 +20,50 @@ public WinXP()
DoubleBuffered = true;
}
public Font fnt;
public ResizeOverlay resizer = new ResizeOverlay();
public UserControl progContent;
public bool resizable = true;
public bool max = false;
public bool closeDisabled = false;
public bool isActive = true;
public bool Resizing = false;
public Bitmap ResizingBmp = null;
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int WM_SYSCOMMAND = 0x0112;
public const int HT_CAPTION = 0x2;
private const int
HTLEFT = 10,
HTRIGHT = 11,
HTTOP = 12,
HTTOPLEFT = 13,
HTTOPRIGHT = 14,
HTBOTTOM = 15,
HTBOTTOMLEFT = 16,
HTBOTTOMRIGHT = 17;
private void closebutton_Click(object sender, EventArgs e)
{
if (!closeDisabled) this.Close();
}
private void top_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && max == false)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
[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 WinXP_Load(object sender, EventArgs e)
{

View file

@ -118,9 +118,8 @@ public WinXP InitXP(UserControl content, string title, Image icon, bool MaxButto
pfc.AddFontFile(SaveSystem.GameDirectory + "\\Data\\LeviWindows.ttf");
Font fnt = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0)));
app.fnt = fnt;
app.Title.Font = new Font(pfc.Families[0], 16F, FontStyle.Bold, GraphicsUnit.Point, ((0)));
// Setup UC
content.Parent = app.programContent;
content.Parent = app.flowLayoutPanel1;
content.BringToFront();
content.Dock = DockStyle.Fill;
app.progContent = content;