Histacom2/Histacom2.Engine/Template/WinXP.cs

89 lines
2.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
2017-10-23 16:49:06 -04:00
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Histacom2.Engine.Template
{
public partial class WinXP : Form
{
public WinXP()
{
InitializeComponent();
2017-10-24 19:21:45 -04:00
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
2017-10-23 12:01:44 -04:00
DoubleBuffered = true;
}
2017-10-23 16:49:06 -04:00
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_MouseDown(object sender, MouseEventArgs e)
{
closebutton.BackgroundImage = Properties.Resources.WinXP_ClosePress;
}
private void closebutton_MouseLeave(object sender, EventArgs e)
{
closebutton.BackgroundImage = Properties.Resources.WinXP_Close;
}
private void closebutton_MouseEnter(object sender, EventArgs e)
{
closebutton.BackgroundImage = Properties.Resources.WinXP_CloseHover;
}
2017-10-23 16:49:06 -04:00
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)
2017-10-23 16:49:06 -04:00
{
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)
{
}
}
}