473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Preventing control movement

I have a Panel derived class on a ScrollableControl derived class. When the
ScrollableControl scrolls, I don't want the panel to move.

I've tried everything I can think of and I can't make this happen. Seems
like it should be simple enough.

Moving it back to where I want it in OnMove or OnLocationChanged is no good
because of the visible jumping.

I've tried handling WM_MOVE in WndProc. I tried setting Result to 0 and 1
and passing it to DefWndProc and WndProc, but neither cancels the move. I've
tried eating the message and not passing it on, but to no avail.

I've tried the same with WM_WINDOWPOSCHANGING but that didn't work.

I'm just stumped. How do I keep this window from moving?

Thanks
Sep 12 '06 #1
3 3182
In addition, I've tried the following in WM_WINDOWPOSCHANGING:

case (int) Win32.Msg.WM_WINDOWPOSCHANGING:
if (moveDisabled_ && m.HWnd == Handle)
{
Win32.WINDOWPOS winPos =
(Win32.WINDOWPOS)m.GetLParam(typeof(Win32.WINDOWPO S));
winPos.flags |= (int)Win32.SetWindowPosFlags.SWP_NOMOVE;
System.Runtime.InteropServices.Marshal.StructureTo Ptr(winPos,
m.LParam, false);
m.Result = (IntPtr) 0;
base.DefWndProc(ref m);
return;
}
break;
And this isn't working either.

I've tried removing the base.DefWndProc and I've tried base.WndProc as well.
None work.

Any help would be appreciated.
"Fredo" <fr***@hotmail.comwrote in message
news:aJ******************************@giganews.com ...
>I have a Panel derived class on a ScrollableControl derived class. When the
ScrollableControl scrolls, I don't want the panel to move.

I've tried everything I can think of and I can't make this happen. Seems
like it should be simple enough.

Moving it back to where I want it in OnMove or OnLocationChanged is no
good because of the visible jumping.

I've tried handling WM_MOVE in WndProc. I tried setting Result to 0 and 1
and passing it to DefWndProc and WndProc, but neither cancels the move.
I've tried eating the message and not passing it on, but to no avail.

I've tried the same with WM_WINDOWPOSCHANGING but that didn't work.

I'm just stumped. How do I keep this window from moving?

Thanks

Sep 12 '06 #2
Why is the panel in the scrollable control, why cant it be hovering above it?

Ciaran O'Donnell

"Fredo" wrote:
In addition, I've tried the following in WM_WINDOWPOSCHANGING:

case (int) Win32.Msg.WM_WINDOWPOSCHANGING:
if (moveDisabled_ && m.HWnd == Handle)
{
Win32.WINDOWPOS winPos =
(Win32.WINDOWPOS)m.GetLParam(typeof(Win32.WINDOWPO S));
winPos.flags |= (int)Win32.SetWindowPosFlags.SWP_NOMOVE;
System.Runtime.InteropServices.Marshal.StructureTo Ptr(winPos,
m.LParam, false);
m.Result = (IntPtr) 0;
base.DefWndProc(ref m);
return;
}
break;
And this isn't working either.

I've tried removing the base.DefWndProc and I've tried base.WndProc as well.
None work.

Any help would be appreciated.
"Fredo" <fr***@hotmail.comwrote in message
news:aJ******************************@giganews.com ...
I have a Panel derived class on a ScrollableControl derived class. When the
ScrollableControl scrolls, I don't want the panel to move.

I've tried everything I can think of and I can't make this happen. Seems
like it should be simple enough.

Moving it back to where I want it in OnMove or OnLocationChanged is no
good because of the visible jumping.

I've tried handling WM_MOVE in WndProc. I tried setting Result to 0 and 1
and passing it to DefWndProc and WndProc, but neither cancels the move.
I've tried eating the message and not passing it on, but to no avail.

I've tried the same with WM_WINDOWPOSCHANGING but that didn't work.

I'm just stumped. How do I keep this window from moving?

Thanks


Sep 12 '06 #3
I've actually considered that as well.

The problem is that, if the parent of the controls is moved, the two
controls may move in a disjointed fashion and we'd like to avoid that. In
fact, one of the container controls we use (all of our controls are custom),
moves controls around in response to user input and we'd like this control
to move as one.

We could create a parent control to hold them all, but that's not feasible
either at this point. We're getting near shipping and that would break all
the existing code using the control in question.

So the best solution would simply be to prevent the panel from moving when
the control scrolls.

"Ciaran O''Donnell" <Ci************@discussions.microsoft.comwrote in
message news:C7**********************************@microsof t.com...
Why is the panel in the scrollable control, why cant it be hovering above
it?

Ciaran O'Donnell

"Fredo" wrote:
>In addition, I've tried the following in WM_WINDOWPOSCHANGING:

case (int) Win32.Msg.WM_WINDOWPOSCHANGING:
if (moveDisabled_ && m.HWnd == Handle)
{
Win32.WINDOWPOS winPos =
(Win32.WINDOWPOS)m.GetLParam(typeof(Win32.WINDOWP OS));
winPos.flags |= (int)Win32.SetWindowPosFlags.SWP_NOMOVE;
System.Runtime.InteropServices.Marshal.StructureTo Ptr(winPos,
m.LParam, false);
m.Result = (IntPtr) 0;
base.DefWndProc(ref m);
return;
}
break;
And this isn't working either.

I've tried removing the base.DefWndProc and I've tried base.WndProc as
well.
None work.

Any help would be appreciated.
"Fredo" <fr***@hotmail.comwrote in message
news:aJ******************************@giganews.co m...
>I have a Panel derived class on a ScrollableControl derived class. When
the
ScrollableControl scrolls, I don't want the panel to move.

I've tried everything I can think of and I can't make this happen.
Seems
like it should be simple enough.

Moving it back to where I want it in OnMove or OnLocationChanged is no
good because of the visible jumping.

I've tried handling WM_MOVE in WndProc. I tried setting Result to 0 and
1
and passing it to DefWndProc and WndProc, but neither cancels the move.
I've tried eating the message and not passing it on, but to no avail.

I've tried the same with WM_WINDOWPOSCHANGING but that didn't work.

I'm just stumped. How do I keep this window from moving?

Thanks



Sep 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: red | last post by:
mouse events when the mouse is on a "child control" hi everyone; my problem: I have a userControl in this usercontrol, I have a child control (a button) when the mouse moves over the...
1
by: juli | last post by:
Hello ! I would like to know how do I use the tab control : 1)How do I set the tab page value (I mean what the source of it) ? 2)How can I invoke movement from tab page to another tab page while I...
0
by: sdbranum | last post by:
I have been using Visual C#.NET to code a large project having many data adapters, data sets, datagrids, multiple forms with tab pages, each containing various controls (mostly label, text boxes,...
0
by: Haim | last post by:
Hello All, I am using the Microsoft tab strip control (with multi page) in my ASP .NET application. When I am moving from one tab to another I need to check the current page before I am...
0
by: Chubby Arse | last post by:
Hi all, I have a control, that basically is my own version of the datagrid, except that is renderers purely readonly tabular information. When the control is rendered to the designer, I can...
0
by: Charles Law | last post by:
Sorry for reposting this question, but I did not get a single answer last time, and I'm sure you guys must have some thoughts on the matter. I have a user control which can be dragged and dropped...
10
MrStephens
by: MrStephens | last post by:
I am a C++ teacher and we are playing with graphics now at the end of the semester. I have never taken a class, I just taught myself from our book. There is no graphics mentioned in our textbook...
5
by: Sedecrem | last post by:
I am creating a 'frogger' like game. Essentially there are ten lanes each with an image array associated with it. The arrays are named from imglane0() to imglane9(). I was creating a piece of code...
5
by: hurricane_number_one | last post by:
I am creating a simple server application, that will listen for incoming mouse coordinates and then move the mouse accordingly. So basically it's like a very simple VNC server without and screen...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.