Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I need some sort of font size selection in my toolbar, just like work has.

Adding a new button with the dropdown property set and having contextmenu containing the fontsizes connected doesn't work since there's no label to show the current size next to the little arrow.

Debug me...
Posted
Instead of using a button/context menu, just use a ComboBox. Then it would be the same interface pretty much everyone is used to seeing.
Being smarter than you look is always better than looking smarter than you are.
Posted
...., just use a ComboBox. .....

 

thx for the hint but how do I add a combobox to the toolbar. I thought the only way to add something to the toolbar was using the button enumeration.

Debug me...
Posted

You can add whatever Control you want:

The following code is from a project I've been working at:

Protected withEvents oCont as System.Windows.Forms.ContainerControl
Protected withEvents Label1 as System.Windows.Forms.Label
Protected WithEvents _rebar as System.Windows.Forms.ReBar

Protected Sub SetBar()
  Me.Label1.Text = "Some string"
  Me.Label1.Left  = 0
  Me.Label1.Top = 0
  Me.oCont.Controls.Add(Me.Label1)
  _rebar.Bands.Add(oCont)
End Sub

Of course there could be better ways, but thats my solution. I added my Label to a new Toolbar. But I think if your searching a little bit, you can add it to your Toolbar that easy.

Any questions? Just ask!

Posted (edited)

THX my mistake was to think I could only add items to the toolbar via the button collection. I haven't tried to add the combobox directly to the toolbar. That's what I get for using the form designer.

 

:D

Edited by Malfunction
Debug me...
Posted (edited)

Now it's getting funny...

As you know I'm using VSN. The buttons are added by the Buttons collection (dialog) of that toolbar. The comboBox is added manually. The next problem is that I can't position the buttons added to the Buttons collection. So I end up having all the buttons to the left and the comboBox to their right.

How can I position the comboBox to the left or in between two buttons?

Is it possible when using the Buttons collection or do I have to do add everything manually?

 

THX so far.......

 

I've just discovered that the ComboBox is actually not added to the ToolBar but placed on top of it. :rolleyes:

So how do I generally add stuff to a ToolBar in VSN?

Edited by Malfunction
Debug me...
Posted
ToolBar.Controls.Add( your control )

 

;) I knew that....so I can only do it dynamically not in the froms designer?

 

If yes the toolbar can generally not be created in the forms designer when containing anything besides buttons in the toolbars' Buttons collection.

Debug me...
  • *Gurus*
Posted

Voca, what is this System.Windows.Forms.ReBar of which you speak? Windows forms does not have a rebar control.

 

Malfunction; the standard toolbar is very limited in what it can do - if you want it to display anything other than normal buttons and separators you're out of luck, you'll have to implement it manually. There are many good third-party toolbar/menu replacements which have this functionality built in (like my own - see my signature).

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted
.... the standard toolbar is very limited in what it can do - if you want it to display anything other than normal buttons and separators you're out of luck, you'll have to implement it manually.....

 

Yeah that's just what I've been thinking :D

Currently checking your link thx for your support.

Debug me...
Posted
Voca, what is this System.Windows.Forms.ReBar of which you speak? Windows forms does not have a rebar control.

 

Sorry, lost track of my Controls and Standardcontrols :p Rebar is simply a toolbar with some advanced features.

 

Voca

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...