Is there any control that can move the Window without the Title bar(Top one)/No frame at all.
I am making a note application as you know so I want it to be compact.
Is there any control that can move the Window without the Title bar(Top one)/No frame at all.
I am making a note application as you know so I want it to be compact.
You need to return HTCAPTION from the WM_NCHITTEST in your WndProc:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
const int WM_NCHITTEST = 0x0084;
const int HTCLIENT = 1;
const int HTCAPTION = 2;
protected override void WndProc(ref Message msg)
{
base.WndProc(ref msg);
if (msg.Msg == WM_NCHITTEST && msg.Result == (IntPtr)HTCLIENT)
{
msg.Result = (IntPtr)HTCAPTION;
}
}
}
That will make the client area of your window seem to Windows to be a caption bar.
Having attempted something like this before I can tell you it isn't particularly easy. What you'll need to do is provided on an OnMouseDown/OnMouseMove/OnMouseUp event to the form itself (or some control in the form) that updates the position of the control when the user clicks and drags. To my knowledge there is no built in control that will allow you to click and drag a window other than the title.
If you are going to build a application from scratch I would recommend creating it using WPF.
Todd Miranda has a great demonstration of creating a gadget like application over at windowsclient.net.
Link to the demonstration: http://windowsclient.net/learn/video.aspx?v=5177