Inheritance: System.Windows.Forms.NativeWindow
示例#1
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            INITCOMMONCONTROLSEX ComCtls = new INITCOMMONCONTROLSEX();

            ComCtls.dwICC  = (uint)win32.ICC_COOL_CLASSES;
            ComCtls.dwSize = (uint)Marshal.SizeOf(ComCtls);
            bool Result = win32.InitCommonControlsEx(ref ComCtls);

            if (!Result)
            {
                MessageBox.Show("There was a tragic error.  InitCommControlsEx Failed!");
            }
            else
            {
                _rebar = new NativeRebar(win32.CreateWindowEx(
                                             0U,
                                             "ReBarWindow32",
                                             null,
                                             (uint)Style,
                                             0, 0, this.Width, this.Height,
                                             this.Handle,
                                             (IntPtr)1,//This will always be the only child window
                                             IntPtr.Zero,
                                             0
                                             ));
                win32.SetWindowLongPtr(_rebar.Handle, (int)win32.GWL_EXSTYLE, (IntPtr)win32.WS_EX_TOOLWINDOW);
                _rebar.WindowPosChanging      += new NativeRebarEventHandler(OnWindowPosChanging);
                _rebar.WindowsMessageRecieved += new NativeRebarEventHandler(OnWindowsMessageRecieved);
                UpdateImageList();
                UpdateColors();
                foreach (RebarBand band in _bands)
                {
                    band.CreateBand();
                }
            }
        }
示例#2
0
        protected override void OnCreateControl() {
            base.OnCreateControl();
            INITCOMMONCONTROLSEX ComCtls = new INITCOMMONCONTROLSEX();
            ComCtls.dwICC = (uint)win32.ICC_COOL_CLASSES;
            ComCtls.dwSize = (uint)Marshal.SizeOf( ComCtls );
            bool Result = win32.InitCommonControlsEx( ref ComCtls );
            if ( !Result ) {
                MessageBox.Show( "There was a tragic error.  InitCommControlsEx Failed!" );
            } else {

                _rebar = new NativeRebar( win32.CreateWindowEx(
                    0U,
                    "ReBarWindow32",
                    null,
                    (uint)Style,
                    0, 0, this.Width, this.Height,
                    this.Handle,
                    (IntPtr)1,//This will always be the only child window
                    IntPtr.Zero,
                    0
                    ) );
                win32.SetWindowLongPtr( _rebar.Handle, (int)win32.GWL_EXSTYLE, (IntPtr)win32.WS_EX_TOOLWINDOW );
                _rebar.WindowPosChanging += new NativeRebarEventHandler( OnWindowPosChanging );
                _rebar.WindowsMessageRecieved += new NativeRebarEventHandler( OnWindowsMessageRecieved );
                UpdateImageList();
                UpdateColors();
                foreach ( RebarBand band in _bands ) {
                    band.CreateBand();
                }
            }
        }