コード例 #1
0
ファイル: RebarWrapper.cs プロジェクト: dummy3k/RebarControl
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            INITCOMMONCONTROLSEX ComCtls = new INITCOMMONCONTROLSEX();

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

            if (!Result)
            {
                MessageBox.Show("There was a tragic error.  InitCommControlsEx Failed!");
            }
            else
            {
                _rebar = new NativeRebar(User32Dll.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
                                             ));
                User32Dll.SetWindowLongPtr(_rebar.Handle, (int)WindowLongConstants.GWL_EXSTYLE, (IntPtr)0x80);
                _rebar.WindowPosChanging      += new NativeRebarEventHandler(OnWindowPosChanging);
                _rebar.WindowsMessageRecieved += new NativeRebarEventHandler(OnWindowsMessageRecieved);
                UpdateImageList();
                UpdateColors();
                foreach (BandWrapper band in _bands)
                {
                    band.CreateBand();
                }
            }
        }
コード例 #2
0
ファイル: RebarWrapper.cs プロジェクト: dummy3k/RebarControl
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            INITCOMMONCONTROLSEX ComCtls = new INITCOMMONCONTROLSEX();
            ComCtls.dwICC = (uint)InitWindowsCommonControlsConstants.ICC_COOL_CLASSES;
            ComCtls.dwSize = (uint)Marshal.SizeOf(ComCtls);
            bool Result = ComCtl32Dll.InitCommonControlsEx(ref ComCtls);
            if(!Result) MessageBox.Show("There was a tragic error.  InitCommControlsEx Failed!");
            else
            {

                _rebar = new NativeRebar(User32Dll.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
                    ));
                User32Dll.SetWindowLongPtr(_rebar.Handle, (int)WindowLongConstants.GWL_EXSTYLE, (IntPtr)0x80);
                _rebar.WindowPosChanging += new NativeRebarEventHandler(OnWindowPosChanging);
                _rebar.WindowsMessageRecieved += new NativeRebarEventHandler(OnWindowsMessageRecieved);
                UpdateImageList();
                UpdateColors();
                foreach(BandWrapper band in _bands)
                {
                    band.CreateBand();
                }
            }
        }