
Signature
HTH
Stoitcho Goutsev (100) [C# MVP]
Hi Stoitcho,
Thank you again for your explanations. Sorry for my misunderstandings of
components and controls.
Now i have to explain a little bit more of my project and what i've already
tested:
The width of the columns in the ListView is fixed and the user is not
allowed to resize the column width neither with a mouse drag nor with a
double click. I've got a tip from Claes Bergefall to catch these events.
But the mouse cursor changes to "ve_sizeb.cur". If you see this cursor you
think you can resize the column width.
Now i wanted to catch the mouse move event before the mouse cursor changes
to "ve_sizeb.cur". My first guess was to use the mouse move event of the
ListView. But there is no mouse move event when you move the mouse over the
column header.
Here is my MouseMove event:
protected override void OnMouseMove(MouseEventArgs e)
{
// store the mouse position in the HitTestInfo structure
HDHITTESTINFO mPoint = new HDHITTESTINFO();
mPoint.pt.X = e.X;
mPoint.pt.Y = e.Y;
// get the position of the mouse in the listview header.
// The header control includes all columns.
// Get a handle to the header control.
IntPtr hc;
hc = SendMessage(this.Handle, new IntPtr(LVM_GETHEADER), new IntPtr(0),
new IntPtr(0));
hc = SendMessage(hc, new IntPtr(HDM_HITTEST), new IntPtr(0), ref mPoint);
if (mPoint.flags != HHT_ONDIVIDER)
base.OnMouseMove (e);
}
There is never a flag with HHT_ONDIVIDER, all flags i get are HHT_BELOW.
There is no y-position of the mouse smaller than 18 (the height of the
ColumnHeader). Now i think there is a control catching the mouse move event
in the area of the column headers.
Is there any way to prevent the mouse cursor to change to the resizign cursor?
Thank you,
Georg
"Stoitcho Goutsev (100) [C# MVP]" wrote:
> Hi Georg,
>
[quoted text clipped - 5 lines]
> ColumnHeader it doesn't. Look at the control that uses those headers. there
> you will find the event, I believe
Stoitcho Goutsev \(100\) [C# MVP] - 14 Oct 2004 00:41 GMT
Hi Georg,
listview column header is a separate window. That's why you don't receive
messages (events) for it. Native ListView doesn't notify for mouse moves
over the header thus .NET cotntrol doesn't have events as well.
I can see that this window has CLASSWND of SysHeader32 so it can be
subclassed in order to intercept those messages, however this is not good
idea since it is not documented, thus subject to change. Beside this, IMHO,
there is no way to process those messages.

Signature
Stoitcho Goutsev (100) [C# MVP]
> Hi Stoitcho,
>
[quoted text clipped - 57 lines]
>> there
>> you will find the event, I believe
Georg Winkelhofer - 14 Oct 2004 13:39 GMT
Hi Stoitcho,
thank you again for your help. It's time for me to give up looking for a
solution to my problem. I've to live with the change of the mouse cursor, but
I#ve learned a lot new things about controls and components in .NET.
Thanx,
Georg
"Stoitcho Goutsev (100) [C# MVP]" wrote:
> Hi Georg,
>
[quoted text clipped - 5 lines]
> idea since it is not documented, thus subject to change. Beside this, IMHO,
> there is no way to process those messages.