/// <summary> Overridden window message processing. </summary> protected override void WndProc(ref Message Msg) { if (Msg.Msg == Win32.WM_MOUSEMOVE) { int PosX = Win32.GET_X_LPARAM(( uint )Msg.LParam); int PosY = Win32.GET_Y_LPARAM(( uint )Msg.LParam); int ColumnStart = 0; int ColumnEnd = 0; CurrentColumnIndex = -1; // Find on which column we should show the tooltip. for (int ColumnIndex = 0; ColumnIndex < Parent.Columns.Count; ColumnIndex++) { int ColumnWidth = Parent.Columns[ColumnIndex].Width; ColumnEnd = ColumnStart + ColumnWidth; if (PosX >= ColumnStart && PosX < ColumnEnd) { CurrentColumnIndex = ColumnIndex; break; } ColumnStart = ColumnEnd; } if (CurrentColumnIndex == -1) { HeaderToolTip.Hide(Parent); } else if (CurrentColumnIndex != LastColumnIndex) { Win32.TRACKMOUSEEVENT trackMouseEvent = new Win32.TRACKMOUSEEVENT(Win32.ETrackMouseEvent.TME_HOVER, Handle, Win32.HOVER_DEFAULT); Win32.TrackMouseEvent(ref trackMouseEvent); HeaderToolTip.Hide(Parent); } LastColumnIndex = CurrentColumnIndex; } else if (Msg.Msg == Win32.WM_MOUSELEAVE) { HeaderToolTip.Hide(Parent); LastColumnIndex = -1; } else if (Msg.Msg == Win32.WM_MOUSEHOVER) { if (bAllowTooltips && CurrentColumnIndex != -1) { int PosX = Win32.GET_X_LPARAM(( uint )Msg.LParam); int PosY = Win32.GET_Y_LPARAM(( uint )Msg.LParam); // Show tooltip. HeaderToolTip.Show(Parent.ColumnsTooltips[CurrentColumnIndex], Parent, PosX, PosY + 32); } } // Default processing. base.WndProc(ref Msg); }
/// <summary> Overridden window message processing. </summary> protected override void WndProc( ref Message Msg ) { if( Msg.Msg == Win32.WM_MOUSEMOVE ) { int PosX = Win32.GET_X_LPARAM( ( uint )Msg.LParam ); int PosY = Win32.GET_Y_LPARAM( ( uint )Msg.LParam ); int ColumnStart = 0; int ColumnEnd = 0; CurrentColumnIndex = -1; // Find on which column we should show the tooltip. for( int ColumnIndex = 0; ColumnIndex < Parent.Columns.Count; ColumnIndex++ ) { int ColumnWidth = Parent.Columns[ ColumnIndex ].Width; ColumnEnd = ColumnStart + ColumnWidth; if( PosX >= ColumnStart && PosX < ColumnEnd ) { CurrentColumnIndex = ColumnIndex; break; } ColumnStart = ColumnEnd; } if( CurrentColumnIndex == -1 ) { HeaderToolTip.Hide( Parent ); } else if( CurrentColumnIndex != LastColumnIndex ) { Win32.TRACKMOUSEEVENT trackMouseEvent = new Win32.TRACKMOUSEEVENT( Win32.ETrackMouseEvent.TME_HOVER, Handle, Win32.HOVER_DEFAULT ); Win32.TrackMouseEvent( ref trackMouseEvent ); HeaderToolTip.Hide( Parent ); } LastColumnIndex = CurrentColumnIndex; } else if( Msg.Msg == Win32.WM_MOUSELEAVE ) { HeaderToolTip.Hide( Parent ); LastColumnIndex = -1; } else if( Msg.Msg == Win32.WM_MOUSEHOVER ) { if( bAllowTooltips && CurrentColumnIndex != -1 ) { int PosX = Win32.GET_X_LPARAM( ( uint )Msg.LParam ); int PosY = Win32.GET_Y_LPARAM( ( uint )Msg.LParam ); // Show tooltip. HeaderToolTip.Show( Parent.ColumnsTooltips[ CurrentColumnIndex ], Parent, PosX, PosY + 32 ); } } // Default processing. base.WndProc( ref Msg ); }