mirror of
https://github.com/HistacomUnity/Histacom2-old.git
synced 2025-01-22 09:02:01 -05:00
Resize system!
This commit is contained in:
parent
1523a8133e
commit
caeae8c966
7 changed files with 331 additions and 64 deletions
|
@ -54,6 +54,12 @@
|
|||
<Compile Include="Paintbrush.cs" />
|
||||
<Compile Include="SaveSystem.cs" />
|
||||
<Compile Include="TaskBarController.cs" />
|
||||
<Compile Include="Template\ResizeOverlay.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Template\ResizeOverlay.Designer.cs">
|
||||
<DependentUpon>ResizeOverlay.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Template\Win9XBSOD.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -102,6 +108,9 @@
|
|||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Template\ResizeOverlay.resx">
|
||||
<DependentUpon>ResizeOverlay.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Template\Win9XBSOD.resx">
|
||||
<DependentUpon>Win9XBSOD.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
78
Histacom2.Engine/Template/ResizeOverlay.Designer.cs
generated
Normal file
78
Histacom2.Engine/Template/ResizeOverlay.Designer.cs
generated
Normal file
|
@ -0,0 +1,78 @@
|
|||
namespace Histacom2.Engine.Template
|
||||
{
|
||||
partial class ResizeOverlay
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.outline = new System.Windows.Forms.PictureBox();
|
||||
this.tmrMove = new System.Windows.Forms.Timer(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.outline)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// outline
|
||||
//
|
||||
this.outline.BackColor = System.Drawing.Color.Transparent;
|
||||
this.outline.Location = new System.Drawing.Point(194, 158);
|
||||
this.outline.Name = "outline";
|
||||
this.outline.Size = new System.Drawing.Size(300, 158);
|
||||
this.outline.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.outline.TabIndex = 0;
|
||||
this.outline.TabStop = false;
|
||||
this.outline.Paint += new System.Windows.Forms.PaintEventHandler(this.outline_Paint);
|
||||
//
|
||||
// tmrMove
|
||||
//
|
||||
this.tmrMove.Interval = 20;
|
||||
this.tmrMove.Tick += new System.EventHandler(this.tmrMove_Tick);
|
||||
//
|
||||
// ResizeOverlay
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1)))));
|
||||
this.ClientSize = new System.Drawing.Size(800, 600);
|
||||
this.Controls.Add(this.outline);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "ResizeOverlay";
|
||||
this.Tag = "ignoreFormOnTaskbar";
|
||||
this.Text = "ResizeOverlay";
|
||||
this.TopMost = true;
|
||||
this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1)))));
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
((System.ComponentModel.ISupportInitialize)(this.outline)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox outline;
|
||||
public System.Windows.Forms.Timer tmrMove;
|
||||
}
|
||||
}
|
35
Histacom2.Engine/Template/ResizeOverlay.cs
Normal file
35
Histacom2.Engine/Template/ResizeOverlay.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
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.Windows.Forms;
|
||||
|
||||
namespace Histacom2.Engine.Template
|
||||
{
|
||||
public partial class ResizeOverlay : Form
|
||||
{
|
||||
public Rectangle ToDraw = new Rectangle();
|
||||
|
||||
public ResizeOverlay()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void tmrMove_Tick(object sender, EventArgs e)
|
||||
{
|
||||
outline.Bounds = ToDraw; // Pens.Gray, ToDraw);
|
||||
}
|
||||
|
||||
private void outline_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.FillRectangle(Brushes.Gray, 0, 0, outline.Width, 4); // Top border
|
||||
e.Graphics.FillRectangle(Brushes.Gray, 0, outline.Height - 4, outline.Width, 4); // Bottom border
|
||||
e.Graphics.FillRectangle(Brushes.Gray, 0, 0, 4, outline.Height); // Left border
|
||||
e.Graphics.FillRectangle(Brushes.Gray, outline.Width - 4, 0, 4, outline.Height); // Right border
|
||||
}
|
||||
}
|
||||
}
|
123
Histacom2.Engine/Template/ResizeOverlay.resx
Normal file
123
Histacom2.Engine/Template/ResizeOverlay.resx
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="tmrMove.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
8
Histacom2.Engine/Template/WinClassic.Designer.cs
generated
8
Histacom2.Engine/Template/WinClassic.Designer.cs
generated
|
@ -162,6 +162,7 @@ private void InitializeComponent()
|
|||
this.toprightcorner.TabIndex = 6;
|
||||
this.toprightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.toprightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.toprightcorner_MouseMove);
|
||||
this.toprightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// bottomrightcorner
|
||||
//
|
||||
|
@ -174,6 +175,7 @@ private void InitializeComponent()
|
|||
this.bottomrightcorner.TabIndex = 4;
|
||||
this.bottomrightcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.bottomrightcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomrightcorner_MouseMove);
|
||||
this.bottomrightcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// bottomleftcorner
|
||||
//
|
||||
|
@ -186,6 +188,7 @@ private void InitializeComponent()
|
|||
this.bottomleftcorner.TabIndex = 2;
|
||||
this.bottomleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.bottomleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottomleftcorner_MouseMove);
|
||||
this.bottomleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// topleftcorner
|
||||
//
|
||||
|
@ -197,6 +200,7 @@ private void InitializeComponent()
|
|||
this.topleftcorner.TabIndex = 1;
|
||||
this.topleftcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.topleftcorner.MouseMove += new System.Windows.Forms.MouseEventHandler(this.topleftcorner_MouseMove);
|
||||
this.topleftcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// left
|
||||
//
|
||||
|
@ -209,6 +213,7 @@ private void InitializeComponent()
|
|||
this.left.TabIndex = 3;
|
||||
this.left.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.left.MouseMove += new System.Windows.Forms.MouseEventHandler(this.left_MouseMove);
|
||||
this.left.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// bottom
|
||||
//
|
||||
|
@ -222,6 +227,7 @@ private void InitializeComponent()
|
|||
this.bottom.TabIndex = 5;
|
||||
this.bottom.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.bottom.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bottom_MouseMove);
|
||||
this.bottom.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// right
|
||||
//
|
||||
|
@ -234,6 +240,7 @@ private void InitializeComponent()
|
|||
this.right.TabIndex = 7;
|
||||
this.right.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.right.MouseMove += new System.Windows.Forms.MouseEventHandler(this.right_MouseMove);
|
||||
this.right.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// top
|
||||
//
|
||||
|
@ -247,6 +254,7 @@ private void InitializeComponent()
|
|||
this.top.TabIndex = 8;
|
||||
this.top.MouseDown += new System.Windows.Forms.MouseEventHandler(this.border_MouseDown);
|
||||
this.top.MouseMove += new System.Windows.Forms.MouseEventHandler(this.top_MouseMove);
|
||||
this.top.MouseUp += new System.Windows.Forms.MouseEventHandler(this.border_MouseUp);
|
||||
//
|
||||
// WinClassic
|
||||
//
|
||||
|
|
|
@ -14,13 +14,13 @@ public WinClassic()
|
|||
}
|
||||
|
||||
public Font fnt;
|
||||
public ResizeOverlay resizer = new ResizeOverlay();
|
||||
|
||||
public bool resizable = true;
|
||||
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;
|
||||
|
@ -74,8 +74,9 @@ private void right_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, this.Size.Height);
|
||||
this.Invalidate();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = MousePosition.X - this.Location.X;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,9 +84,10 @@ private void left_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable)this.Location = new Point(Cursor.Position.X, this.Location.Y);
|
||||
this.Invalidate();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) toDraw.X = Cursor.Position.X;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,8 +95,10 @@ private void bottom_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Size = new Size(this.Size.Width, MousePosition.Y - this.Location.Y);
|
||||
this.Invalidate();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Y = this.Location.Y;
|
||||
if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) + Cursor.Position.Y);
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,8 +106,10 @@ private void bottomrightcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Size = new Size(MousePosition.X - this.Location.X, MousePosition.Y - this.Location.Y);
|
||||
this.Invalidate();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = MousePosition.X - this.Location.X;
|
||||
if (resizable) toDraw.Height = MousePosition.Y - this.Location.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,10 +117,11 @@ private void bottomleftcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) this.Height = (Cursor.Position.Y - this.Location.Y);
|
||||
if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y);
|
||||
this.Invalidate();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = ((toDraw.Width + toDraw.Location.X) - Cursor.Position.X);
|
||||
if (resizable) toDraw.Height = Cursor.Position.Y - this.Location.Y;
|
||||
if (resizable) toDraw.X = Cursor.Position.X;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,11 +129,12 @@ private void topleftcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) this.Location = new Point(Cursor.Position.X, this.Location.Y);
|
||||
if (resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y);
|
||||
if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y);
|
||||
this.Invalidate();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = ((this.Width + this.Location.X) - Cursor.Position.X);
|
||||
if (resizable) toDraw.X = Cursor.Position.X;
|
||||
if (resizable) toDraw.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y);
|
||||
if (resizable) toDraw.Y = Cursor.Position.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,9 +142,10 @@ private void top_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if(e.Button == MouseButtons.Left)
|
||||
{
|
||||
if(resizable) this.Height = ((this.Height + this.Location.Y) - Cursor.Position.Y);
|
||||
if(resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y);
|
||||
this.Invalidate();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y);
|
||||
if (resizable) toDraw.Y = Cursor.Position.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,10 +153,12 @@ private void toprightcorner_MouseMove(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (resizable) this.Width = (Cursor.Position.X - this.Location.X);
|
||||
if (resizable) this.Height = ((this.Location.Y - Cursor.Position.Y) + this.Height);
|
||||
if (resizable) this.Location = new Point(this.Location.X, Cursor.Position.Y);
|
||||
this.Update();
|
||||
var toDraw = resizer.ToDraw;
|
||||
if (resizable) toDraw.Width = (Cursor.Position.X - toDraw.X);
|
||||
if (resizable) toDraw.Height = ((toDraw.Height + toDraw.Top) - Cursor.Position.Y);
|
||||
if (resizable) toDraw.X = Cursor.Position.X;
|
||||
if (resizable) toDraw.Y = Cursor.Position.Y;
|
||||
resizer.ToDraw = toDraw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,6 +171,15 @@ private void WinClassic_Paint(object sender, PaintEventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
private void border_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Bounds = resizer.ToDraw;
|
||||
resizer.tmrMove.Stop();
|
||||
resizer.Close();
|
||||
|
||||
resizer = new ResizeOverlay();
|
||||
}
|
||||
|
||||
private void border_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
var cursor = this.PointToClient(Cursor.Position);
|
||||
|
@ -174,22 +194,16 @@ private void border_MouseDown(object sender, MouseEventArgs e)
|
|||
else if (right.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF002, 0);
|
||||
else if (bottom.ClientRectangle.Contains(cursor)) SendMessage(Handle, WM_SYSCOMMAND, 0xF006, 0);
|
||||
|
||||
/* Now we need to fix this weird artificating!
|
||||
To lempamo: This is probably the best way I can think of the fix this
|
||||
I can take a picture of the window as it is and then just draw that
|
||||
and once you mouseup I will go back to the actual form
|
||||
I'll have a boolean called Resizing which tells the form on paint to just draw the overlay!
|
||||
*/
|
||||
// Now we need to fix this weird artificating!
|
||||
|
||||
var screen = Screen.PrimaryScreen;
|
||||
resizer.tmrMove.Start();
|
||||
resizer.Show();
|
||||
|
||||
using (var bitmap = new Bitmap(this.Bounds.Width, this.Bounds.Height))
|
||||
using (var graphics = Graphics.FromImage(bitmap))
|
||||
{
|
||||
graphics.CopyFromScreen(new Point(this.Bounds.Left, this.Bounds.Top), new Point(0, 0), this.Bounds.Size);
|
||||
Resizing = true;
|
||||
ResizingBmp = bitmap;
|
||||
}
|
||||
resizer.ToDraw = this.Bounds;
|
||||
|
||||
// However this defocuses the window which we don't want
|
||||
|
||||
WinClassic_Activated(null, null);
|
||||
}
|
||||
|
||||
public bool max = false;
|
||||
|
|
|
@ -118,30 +118,6 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD
|
||||
PwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA
|
||||
SUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R
|
||||
DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD
|
||||
TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="toprightcorner.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
|
@ -196,6 +172,30 @@
|
|||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAIAAADAusJtAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAAVSURBVBhXYzh8
|
||||
/DTD////wfTh46cBUSgJ/bC/izUAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="maximizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA+SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HDgwAEQBwcAygIBNTRAJNDAqAY0DbgAdg0EAUIDkEUkAGkgDTAwAACYPGiagsMD
|
||||
PwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="minimizebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAAA5SURBVChTY/hP
|
||||
CmAAAiB1nzjQ0NCA0HCACDCqASqGF2DRAOKjAog4BFBDA36A0ABkEQlAGkgDDAwAKPmlWmNluNoAAAAA
|
||||
SUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="closebutton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAIAAACpTQvdAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wwAADsMBx2+oZAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMzQDW3oAAABcSURBVChTrY/R
|
||||
DcAgCERvdEbrJh2lPU+SYkINRt+PSN6J4FkBhMddw8y+wFUgCbQ70OtO7OQTJLgRa/L7JWmOt8RsB8mD
|
||||
TQ5NkFbeQcLwauzMdkjZCLAq0gJrAC8niIXaIK89FAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue