hi,

Currently i am using the following code to move my borderless form,
where i have my own titlebar using a panel.

private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HTCAPTION = 0x2;

[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int
wParam, int lParam);

private void panel1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
}
}

This code picks up the Windows setting of whether to show the window
contents while dragging or not.

However, i want to always hide the contents of my window while
dragging. Is there a way to achieve this?

Also, with this code when i try to hook the MouseUp event of my
panel1, i am not able to do so. After i perform a mouse click, the
control doesnt transfer to the event handler.

Solution to either of the problems will be of great help

Regards,
Ankit!

Re: Hide window contents while dragging by MickDoherty

MickDoherty
Fri Sep 05 13:17:01 CDT 2008

Why are my messages appearing in this MS hosted Web based newsreader, but not
through the newsgroup readers (Outlook Express, Windows Live Mail)?

This appears to have happened several times in the last week or so!

--
http://dotnetrix.co.uk/nothing.html


"Mick Doherty" wrote:

> Hi Ankit,
>
> That looks very much like the first example on my Forms tips page, which is
> just a quick hack.
> You'll need to override WndProc() and look for the message you sent, which
> will actually be recieved when the mouse button is released.
>
> --8<----------------------
>
> protected override void WndProc(ref Message m)
> {
> base.WndProc(ref m);
>
> if (m.Msg == WM_NCLBUTTONDOWN)
> {
> //This will actually occur at MouseUp
> Point pt = this.PointToClient(Cursor.Position);
> MouseEventArgs mev = new MouseEventArgs(MouseButtons.Left,
> 0, pt.X, pt.Y, 0);
> OnNonClientMouseUp(this, mev);
> }
> }
>
> private void OnNonClientMouseUp(object sender, MouseEventArgs e)
> {
> //Your Non-ClientRectangle MouseUp code goes here
> MessageBox.Show(e.Location.ToString());
> }
>
> --8<----------------------
>
> It's a little more work, but you'd be better off using the last example on
> the same page.
>
> http://dotnetrix.co.uk/form.htm
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.htm
>
> <aagarwal8@gmail.com> wrote in message
> news:8b8985f8-d9aa-42cb-9c80-a304474e5583@a3g2000prm.googlegroups.com...
> >
> > hi,
> >
> > Currently i am using the following code to move my borderless form,
> > where i have my own titlebar using a panel.
> >
> > private const int WM_NCLBUTTONDOWN = 0xA1;
> > private const int HTCAPTION = 0x2;
> >
> > [DllImport("user32.dll")]
> > public static extern bool ReleaseCapture();
> > [DllImport("user32.dll")]
> > public static extern int SendMessage(IntPtr hWnd, int Msg, int
> > wParam, int lParam);
> >
> > private void panel1_MouseDown(object sender, MouseEventArgs e)
> > {
> > if (e.Button == MouseButtons.Left)
> > {
> > ReleaseCapture();
> > SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
> > }
> > }
> >
> > This code picks up the Windows setting of whether to show the window
> > contents while dragging or not.
> >
> > However, i want to always hide the contents of my window while
> > dragging. Is there a way to achieve this?
> >
> > Also, with this code when i try to hook the MouseUp event of my
> > panel1, i am not able to do so. After i perform a mouse click, the
> > control doesnt transfer to the event handler.
> >
> > Solution to either of the problems will be of great help
> >
> > Regards,
> > Ankit!
>
>

Re: Hide window contents while dragging by Herfried

Herfried
Sun Sep 07 12:57:18 CDT 2008

"Mick Doherty" <MickDoherty@discussions.microsoft.com> schrieb:
> Why are my messages appearing in this MS hosted Web based newsreader, but
> not
> through the newsgroup readers (Outlook Express, Windows Live Mail)?
>
> This appears to have happened several times in the last week or so!

I don't know, but I have heard of others experiencing similar problems using
OE and WM. However, I can confirm that your message is available on
'news.microsoft.com'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Re: Hide window contents while dragging by Mick

Mick
Wed Sep 10 07:15:36 CDT 2008

Hi Herfried,

I posted the previous response to my reply via the web based newsreader so I
know it's there, but it appears as though nearly every message that I
respond to via WLM is unavailable anywhere but via the web based newsreader.

I'm just wondering how many people are not seeing my responses or how many
messages are not being seen due to this error.

Are MS aware of this issue and are they tackling it?

--
Mick Doherty
http://dotnetrix.co.uk/nothing.htm

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:ev1xnMREJHA.4900@TK2MSFTNGP06.phx.gbl...
> "Mick Doherty" <MickDoherty@discussions.microsoft.com> schrieb:
>> Why are my messages appearing in this MS hosted Web based newsreader, but
>> not
>> through the newsgroup readers (Outlook Express, Windows Live Mail)?
>>
>> This appears to have happened several times in the last week or so!
>
> I don't know, but I have heard of others experiencing similar problems
> using OE and WM. However, I can confirm that your message is available on
> 'news.microsoft.com'.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>