Skip to content

Commit

Permalink
started main form
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy Watkins authored and Timothy Watkins committed Jan 28, 2016
1 parent d8c870b commit 7c1b0b2
Show file tree
Hide file tree
Showing 18 changed files with 1,295 additions and 18 deletions.
220 changes: 220 additions & 0 deletions RapidLib/Forms/ReporterForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions RapidLib/Forms/ReporterForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace RapidLib.Forms
{
public partial class ReporterForm : Form
{
public ReporterForm()
{
InitializeComponent();
}





#region Resizing and Moving of Borederless Form
protected override void WndProc(ref Message m)
{
const int wmNcHitTest = 0x84;
const int htBottomLeft = 16;
const int htBottomRight = 17;
const int htCaption = 0x2;
if (m.Msg == wmNcHitTest)
{
var x = (int)(m.LParam.ToInt64() & 0xFFFF);
var y = (int)((m.LParam.ToInt64() & 0xFFFF0000) >> 16);
var pt = PointToClient(new Point(x, y));
var clientSize = ClientSize;
if (pt.X >= clientSize.Width - 12 && pt.Y >= clientSize.Height - 12 && clientSize.Height >= 12)
{
m.Result = (IntPtr)(IsMirrored ? htBottomLeft : htBottomRight); // resizable
return;
}

}
base.WndProc(ref m);
if (m.Msg == wmNcHitTest) m.Result = (IntPtr)(htCaption); // movable
}

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
DrawGripper(e);
}

public void DrawGripper(PaintEventArgs e)
{
if (!VisualStyleRenderer.IsElementDefined(VisualStyleElement.Status.Gripper.Normal)) return;
var renderer = new VisualStyleRenderer(VisualStyleElement.Status.Gripper.Normal);
var rectangle1 = new Rectangle((Width) - 18, (Height) - 20, 20, 20);
renderer.DrawBackground(e.Graphics, rectangle1);
}

private void ReporterForm_Resize(object sender, EventArgs e)
{
Invalidate();
}

private void ReporterForm_Move(object sender, EventArgs e)
{
Invalidate();
}
#endregion Resizing and Moving of Borederless Form
}
}
Loading

0 comments on commit 7c1b0b2

Please sign in to comment.