示例#1
0
 public static extern uint SendMessage(IntPtr hWnd, int Msg, int wParam, ref REBARBANDINFO lParam);
示例#2
0
 public static extern uint SendMessage(IntPtr hWnd, int Msg, int wParam, ref REBARBANDINFO lParam);
示例#3
0
        internal void CreateBand()
        {
            if(!Created && _bands != null && _bands.Rebar.Rebar != null)
            {
                if(_child != null) _child.Parent = _bands.Rebar;
                REBARBANDINFO rbBand = new REBARBANDINFO();
                rbBand.cbSize = (uint)Marshal.SizeOf(rbBand);
                rbBand.fMask = (uint)(RebarBandInfoConstants.RBBIM_STYLE
                    | RebarBandInfoConstants.RBBIM_ID | RebarBandInfoConstants.RBBIM_TEXT
                    );//| RebarBandInfoConstants.RBBIM_HEADERSIZE);
                if(!_useCoolbarColors)
                    rbBand.fMask |= (uint) RebarBandInfoConstants.RBBIM_COLORS;
                if(_child != null) //Add ChildSize stuff at some point
                {
                    rbBand.fMask |= (uint) RebarBandInfoConstants.RBBIM_CHILD;
                }
                rbBand.fMask |= (uint) RebarBandInfoConstants.RBBIM_CHILDSIZE;
                if(_image >= 0)
                    rbBand.fMask |= (uint) RebarBandInfoConstants.RBBIM_IMAGE;
                if(_backgroundImage != null)
                    rbBand.fMask |= (uint) RebarBandInfoConstants.RBBIM_BACKGROUND;
                rbBand.clrFore = new COLORREF(ForeColor);
                rbBand.clrBack = new COLORREF(BackColor);
                rbBand.fStyle = (uint)Style;
                if(_backgroundImage != null)
                {
                    rbBand.hbmBack = _pictureHandle;
                }
                rbBand.lpText = _caption;
                if(_child != null)
                {
                    rbBand.hwndChild = _child.Handle;
                    rbBand.cxMinChild = (uint)_minWidth;
                    rbBand.cyMinChild = (uint)_minHeight;
                    rbBand.cyIntegral = (uint)_integral;//0;
                    rbBand.cyChild = (uint)_minHeight;
                    rbBand.cyMaxChild = 40;
                    rbBand.cxIdeal = (uint)_idealWidth;
                    rbBand.cx = (uint)_initalWidth;
                    rbBand.fMask = rbBand.fMask | (uint)RebarBandInfoConstants.RBBIM_SIZE;
                }
                if(_showIcon)
                {
                    rbBand.iImage = _image;
                }
                rbBand.wID = (uint)_id;
                rbBand.cxHeader = (uint)_header;

                if(User32Dll.SendMessage(_bands.Rebar.RebarHwnd, (int)WindowsMessages.RB_INSERTBANDA, -1,ref rbBand) == 0)
                {
                    int LastErr = Marshal.GetHRForLastWin32Error();
                    try
                    {
                        Marshal.ThrowExceptionForHR(LastErr);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(LastErr + " " + ex.Message);
                        if (_throwExceptions) throw(new Exception("Error Creating Band.", ex));
                    }

                }
                else
                {
                    _created = true;
                }

            }
        }
示例#4
0
        protected void UpdateStyles()
        {
            if(Created)
            {
                REBARBANDINFO rbBand = new REBARBANDINFO();
                rbBand.cbSize = (uint)Marshal.SizeOf(rbBand);
                rbBand.fMask = (uint)  RebarBandInfoConstants.RBBIM_STYLE;
                rbBand.fStyle = (uint)Style;

                if(User32Dll.SendMessage(_bands.Rebar.RebarHwnd, (int)WindowsMessages.RB_SETBANDINFOA, BandIndex ,ref rbBand) == 0)
                {
                    int LastErr = Marshal.GetHRForLastWin32Error();
                    try
                    {
                        Marshal.ThrowExceptionForHR(LastErr);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(LastErr + " " + ex.Message);
                        if (_throwExceptions) throw(new Exception("Error Updating Styles.", ex));
                    }

                }
            }
        }
示例#5
0
        protected void UpdateMinimums()
        {
            //return;
            if(Created)
            {
                REBARBANDINFO rbBand = new REBARBANDINFO();
                rbBand.cbSize = (uint)Marshal.SizeOf(rbBand);
                rbBand.fMask = (uint)(RebarBandInfoConstants.RBBIM_CHILDSIZE);
                if (_header != -1) rbBand.fMask |= (uint)RebarBandInfoConstants.RBBIM_HEADERSIZE;
                rbBand.cxMinChild = (uint)_minWidth;
                rbBand.cyMinChild = (uint)_minHeight;
                rbBand.cyIntegral = (uint)_integral;//1;
                rbBand.cyChild = (uint)_minHeight;
                rbBand.cyMaxChild = 300;
                rbBand.cxIdeal = (uint)_idealWidth;
                rbBand.cxHeader = (uint)_header;
                if(User32Dll.SendMessage(_bands.Rebar.RebarHwnd, (int)WindowsMessages.RB_SETBANDINFOA, BandIndex ,ref rbBand) == 0)
                {
                    int LastErr = Marshal.GetHRForLastWin32Error();
                    try
                    {
                        Marshal.ThrowExceptionForHR(LastErr);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(LastErr + " " + ex.Message);
                        if (_throwExceptions) throw(new Exception("Error Updating Minimums.", ex));
                    }

                }

            }
        }
示例#6
0
        protected void UpdateColors()
        {
            if(Created)
            {
                REBARBANDINFO rbBand = new REBARBANDINFO();
                rbBand.cbSize = (uint)Marshal.SizeOf(rbBand);
                rbBand.fMask = (uint) RebarBandInfoConstants.RBBIM_COLORS;
                if(_useCoolbarColors)
                {
                    rbBand.clrBack = new COLORREF();
                    rbBand.clrBack._ColorDWORD = (uint) ColorConstants.CLR_DEFAULT;
                    rbBand.clrFore = new COLORREF();
                    rbBand.clrFore._ColorDWORD = (uint) ColorConstants.CLR_DEFAULT;
                }
                else
                {
                    rbBand.clrBack = new COLORREF(_backColor);
                    rbBand.clrFore = new COLORREF(_foreColor);
                }

                if(User32Dll.SendMessage(_bands.Rebar.RebarHwnd, (int)WindowsMessages.RB_SETBANDINFOA, BandIndex ,ref rbBand) == 0)
                {
                    int LastErr = Marshal.GetHRForLastWin32Error();
                    try
                    {
                        Marshal.ThrowExceptionForHR(LastErr);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(LastErr + " " + ex.Message);
                        if (_throwExceptions) throw(new Exception("Error Updating Foreground and Background Colors.", ex));
                    }

                }
            }
        }
示例#7
0
        protected void UpdateChild()
        {
            if(Created)
            {
                REBARBANDINFO rbBand = new REBARBANDINFO();
                rbBand.cbSize = (uint)Marshal.SizeOf(rbBand);
                rbBand.fMask = (uint)  RebarBandInfoConstants.RBBIM_CHILD;
                if(_child == null)
                {
                    rbBand.hwndChild = IntPtr.Zero;
                }
                else
                {
                    rbBand.hwndChild = _child.Handle;
                }

                if(User32Dll.SendMessage(_bands.Rebar.RebarHwnd, (int)WindowsMessages.RB_SETBANDINFOA, BandIndex ,ref rbBand) == 0)
                {
                    int LastErr = Marshal.GetHRForLastWin32Error();
                    try
                    {
                        Marshal.ThrowExceptionForHR(LastErr);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(LastErr + " " + ex.Message);
                        if (_throwExceptions) throw(new Exception("Error Updating Child.", ex));
                    }

                }
                UpdateMinimums();
            }
        }