 |
|
|
Just a note, this approach is no longer necessary in .NET 2.0. Use a ToolStripContainer and you can raft as many ToolStrips as you want in a single container, giving out-of-the-box floating toolbars. Just hope to save people some trouble if you've already got the tools to do what you need.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
The way to show chevrons in rebar band is adding RBBS_USECHEVRON constant in Style property of BandWrapper component. This can be do it by adding a new boolean field _useChevron to BandWrapper class, and modifing Style property as follows:
protected int Style { get { ... if(_useChevron) style |= (int)RebarBandStyleConstants.RBBS_USECHEVRON; ... return style } set { ... _useChevron = !((value & (int)RebarBandStyleConstants.RBBS_USECHEVRON) == (int)RebarBandStyleConstants.RBBS_USECHEVRON); ... } }
Also, it's very important to modify CreateBand method, adding the following line before creating the band (call to SendMessage):
rbBand.fMask |= (uint) RebarBandInfoConstants.RBBIM_IDEALSIZE;
To trap when a user clicks the chevron you will need to handle RBN_CHEVRONPUSHED to display a dropdown menu. Add a new case in WndProc of RebarWrapper class:
protected override void WndProc(ref System.Windows.Forms.Message m) { if(_rebar != null && m.Msg == (int)WindowsMessages.WM_NOTIFY) { NMHDR Notify = (NMHDR)Marshal.PtrToStructure(m.LParam,typeof(NMHDR)); if(Notify.idFrom == 1) { switch((int)Notify.code) { ... case ((int)WindowsNotifyConstants.RBN_CHEVRONPUSHED): this.NotifyChevronPushed(ref m); break; ... } } } }
and a new method:
private void NotifyChevronPushed(ref Message message) { WindowsUtilities.NMREBARCHEVRON nrch = (WindowsUtilities.NMREBARCHEVRON)message.GetLParam( typeof(WindowsUtilities.NMREBARCHEVRON)); int index = nrch.wID; if( (index >= 0) && (index < this._bands.Count ) && ( this._bands[index] != null)) { Point point = new Point(nrch.rc.left, nrch.rc.bottom); this._bands[index].Show(this, point); } }
This method uses struct NMREBARCHEVRON. Add this struct to WindowsUtilities namespace in file RebarStructs.cs:
[StructLayout(LayoutKind.Sequential)] public struct NMREBARCHEVRON { public NMHDR hdr; public int uBand; public int wID; public int lParam; public RECT rc; public int lParamNM; }
Finally, you must create a public Show method in BandWrapper class:
public void Show(Control control, Point point) { }
This method is responsible of showing a popup context menu or toolbar that include items not shown in toolbar. By now, I'm implementing this method following the guidelines from http://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/ShellCC/platform/commctls/faq/ietoolbar.asp.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Where can I find definitions for different API functions and the structs that they use? For example for REBARABANDINFO.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
How can i set up a rebar for runtime width resize? I'm using vertical rebar, it's running OK but i don't know how to change width of band when program is running. Thanks
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
to all: i am very new to C# development, my background is more J2EE (with some VB some time ago). i am looking to make a floating toolbar in a very effiencient way. i have tried a couple of working hacks, but that's not what i am after.
thanks, rob
-------------------------------------------------------------------- "There are 10 types of people in the world those who understand binary and those who don't."
|
| Sign In·View Thread·PermaLink | 2.33/5 (3 votes) |
|
|
|
 |
|
|
;P Actually I am more concern about the application productive, of course I'm very appreciate who create the nice control to share with us. So, it's the Rebar Control Wrapper bug free already?
Melvin
|
| Sign In·View Thread·PermaLink | 1.80/5 (5 votes) |
|
|
|
 |
|
|
 If you add 2 bands in the rebar wrapper, set the new row attributes to false and place them in one row, you will find the rebar works well unless you minimize the form and restore it. The problem is that the toolbar allocates 2 rows on the screen not one. The second row that should not appear is painted as a gray rectangle.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
The simple workaround:
in RebarWrapper.cs: in method protected override void OnResize(System.EventArgs e)
replace: if(Width != _rebar.BarWidth)
with: if(Width != _rebar.BarWidth && Width != 0)
this avoids setting rebar's width to 0 when form is minimized.
Maybe, similar thing must be done with Vertical rebar.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
After struggling to find out why the chevron code wasn't working properly when the child size changed, I stumbled upon a bug in the UpdateMinimums function. It was just sitting there, waiting to be discovered. A small but important code omisson. Apparently, the fMask is being set to only RBBIM_CHILDSIZE, and not also RBBIM_IDEALSIZE, causing the IdealSize member to never be updated since the band's creation.
Here's the updated code (BandWrapper.cs):
protected void UpdateMinimums() { if(Created) { REBARBANDINFO rbBand = new REBARBANDINFO(); rbBand.cbSize = (uint)Marshal.SizeOf(rbBand); rbBand.fMask = (uint)(RebarBandInfoConstants.RBBIM_CHILDSIZE|RebarBandInfoConstants.RBBIM_IDEALSIZE); 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)); } } } }
I have a symbiotic relationship with my computer.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
You really could do this without API calls.
Chris Pietschmann, MCSD, MCAD http://www.PietschSoft.com
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
How? I've been watching your site for a year now, and I stil can't find a clue to what sollution you have in mind.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I have not had the time to write a control like this that doesn't use API's. But I do know its possible.
Christopher Pietschmann, MCSD, MCAD http://PietschSoft.com/Blog http://SlapDev.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Could someone please help me understand how to position the bands properly? I have too many bands for one row. The first band in the row is positioned properly, left justified, but all other bands in that row are positioned from right to left. I would like all bands to be positioned next to each other upon startup. I looked at the code and tried everything I know of to reposition them properly but nothing seems to work. Is this a bug or am I doing something wrong? Thx.
|
| Sign In·View Thread·PermaLink | 4.00/5 (3 votes) |
|
|
|
 |
|
|
I used this RebarWrapper in desiger mode ,but the bands Collection has some problem ,when i add a band ,i can't delete it from the CollectionEditor. Can you help me ?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Please tell me that how can i implement a floating toolbar window Namely ,I can drag and drop a toolbar and make it be a floating toolbarwindow I'm a Chinese ,My English is poor . My E-Mail is hbchen33@163.com Can you help me to solve this problem
|
| Sign In·View Thread·PermaLink | 3.67/5 (3 votes) |
|
|
|
 |
|
|
 |
|
|
Hi Anthony (and all others)!
Is there any way to make the toolbars display vertically and / or to let them float like in VisualStudio or Office?
I've tested Your code with CCS_LEFT-/CBRS_LEFT-style-flags, but it doesn't work properly 
TIA
Mikey
|
| Sign In·View Thread·PermaLink | 1.67/5 (3 votes) |
|
|
|
 |
|
|
Yes. I do need an answer for this question ...
or Is it possible to write one such control without using windows programming ? Can any one guide me ?
Srinivas
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |