|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category.
** PLEASE BE SPECIFIC WITH YOUR QUESTION **
When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
April 28th, 2005, 10:26 PM
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Buttons of different sizes needed in the toolbar
In my VB.NET application , I am displaying some buttons in the application toolbar like "open", "New", "Save" etc.
I am using ImageList for displaying icons on these buttons.
The problem is that one of these buttons has to be "Save and Close".
Conventionally this particular button is diaplayed as having the same image as a Save button followed by the text "Save and Close".
e.g. As Microsoft has done in outlook. while adding a new contact, on the "Contact" dialog toolbar there is a Save and Close button.
But in my application the button size is 16,x16 and Save image followed by the text "Save and Close" is too big to fit into this size.
Can i change the size of a single button on the toolbar? As of now, i Know that all buttons on the toolbar have the same size.
And i dont want to make all the buttons on the toolbar that big.
We often see buttons of different sizes in applications. for e.g. Outlook and IE also (Back button's size is bigger than Stop and Refresh buttons)
How should i solve the problem i am stuck in? Please Help.
|
April 29th, 2005, 01:15 AM
|
|
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
The image for the Back button in IE is not larger than the others. However, it has an additional label associated with it. If you right-click the toolbar and choose Customize, you can turn on this label for all buttons after. Then the text will be displayed under the image. The back button then is still a little bit larger, because it has an additional drop-down.
Anyway, IMO all images on tool bars should have the same size. This really helps in creating a solid and consistent look and feel. To the right (or left in an RTL language) of, or under these buttons, additional text, drop-downs or other info can be displayed, but usually all the images have the same dimensions.
Can't you just resize or crop the larger image?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
April 29th, 2005, 07:18 AM
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I tried adding the trailing text to the buttons on my toolbar also. In fact thats exactly what i want to do.
Add a text "Save and Close" to my Save and Close toolbar button.
Even though i choose the option to add text to my button from button properties in the toolbar... the text is not getting displayed, cos the button area is too small!
If however i increase the button size, then "Save&Close" button is getting disaplyed all with the text. Problem solved? no... cos then all the buttons have gotten bigger...(why do all the buttons, compulsively have to have the same size)
If buttons are big..the non client area becomes so big that the form looks ugly.
How are these guys doing it in IE or outlook..?
|
May 1st, 2005, 05:22 AM
|
|
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I am not sure I understand what the problem is.
I can successfully add a bunch of buttons to a toolbar, some with text and some without. Those without text are square and the ones with the text are wider to accommodate for the text.
I first created an ImageList with my images (all with a different size) and then I added a toolbar and assigned it the ImageList. Finally, I added new buttons and for each button I chose an image from the ImageList. That worked for me....
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Jacks Shadow by Nick Cave & the Bad Seeds (Track 3 from the album: Your Funeral...My Trial) What's This?
|
May 2nd, 2005, 03:02 AM
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by Imar
I can successfully add a bunch of buttons to a toolbar, some with text and some without. Those without text are square and the ones with the text are wider to accommodate for the text.
|
Now thats my problem-- The buttons i add "with text" are also square. i.e. Adding a text to the button does not widen the button to accomodate the text. So the text appears to be truncated.
Did u do any special settings besides the steps that u have specified for creating a toolbar?
|
May 2nd, 2005, 12:06 PM
|
|
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
No, I didn't. It just worked after creating a new toolbar and a new image list.
What version of VS.NET are you using?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Sleep Alone by Moby (Track 13 from the album: 18) What's This?
|
May 2nd, 2005, 11:30 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
<s>Same for me. No problem replicating what Imar did.</s>
Tried it again with different results. This time when I tried it, I had happen what Jell stated. Here is how I managed to do it:
I added a toolbar before I added an imagelist. If I went in to set some of the text for the toolbar (still no imagelist), the text was trunctated with a few characters of the text (sometimes only 1 or 2) and then "...". This stayed that way even after I added an imagelist and set the image for the toolbar button.
This also threw a few additional problems. When I finally did get the image to show this time correctly with the text, it made all of the buttons the same width regardless of whether or not they had an image (they were too long and showing empty space).
How I worked around it:
I added the imagelist to the project and populated it before I added the toolbar. The when I added the toolbar, I set the imagelist for the toolbar before I added any buttons. Once a button was added, I set the image index for it. This seemed to make the toolbars buttons behave the way they should.
It seems that if controls aren't added and some of the properties aren't set in the correct order, it throws the toolbar for a loop.
HTH
J
|
May 3rd, 2005, 06:27 AM
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Great! Your work around has helped me solve my problem.
Thanks a ton!
Regards,
Jell
|
May 3rd, 2005, 08:48 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Glad I could help.
J
|
|
|