protected void UpdateImageList() { if ( _rebar != null ) { REBARINFO RBInfo = new REBARINFO(); RBInfo.cbSize = (uint)Marshal.SizeOf( RBInfo ); RBInfo.fMask = (uint)win32.RBIM_IMAGELIST; if ( _imageList == null ) { RBInfo.himl = IntPtr.Zero; } else { RBInfo.himl = _imageList.Handle; } if ( win32.SendMessage( _rebar.Handle, (int)win32.RB_SETBARINFO, 0, ref RBInfo ) == 0 ) { int LastErr = Marshal.GetHRForLastWin32Error(); try { Marshal.ThrowExceptionForHR( LastErr ); } catch ( Exception ex ) { System.Diagnostics.Debug.WriteLine( LastErr + " " + ex.Message ); if ( _throwExceptions ) throw (new Exception( "Error Setting Imagelist.", ex )); } } } }
public static extern uint SendMessage( IntPtr hWnd, int Msg, int wParam, ref REBARINFO lParam );