Solved

How to create a multiline contextmenustrip?

Posted on 2009-06-30
4
520 Views
Last Modified: 2013-11-27
I want to create a multiline contextmenustrip,i.e.,I want to have 1 menu multiline and the rest single line.I tried inserting "&vbnewline" at runtime while assigning the text property,it worked but the height of all the other menus increased as well.I want to know if its possible to keep the height of all menu constant and just increase 1 in a single contextmenustrip.Thanx for any cooperation.
0
Comment
Question by:Amitava_Mukherjee
  • 2
  • 2
4 Comments
 
LVL 48

Expert Comment

by:jpaulino
Comment Utility
Hi,
 
You can define the AutoSize property to false and define your own size.
Example:

        Dim item As New ToolStripMenuItem

        item.AutoSize = False

        item.Size = New Size(120, 100)

        item.Text = "line 1" & vbNewLine & "line 2"

        Me.ContextMenuStrip1.Items.Add(item)

Open in new window

0
 

Author Comment

by:Amitava_Mukherjee
Comment Utility
Nice Solution :-).
One small hickup, Other menus are increased in height slightly in the same context menu.
Any Suggestion?
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 250 total points
Comment Utility
Can you show a screenshot ?
0
 

Author Closing Comment

by:Amitava_Mukherjee
Comment Utility
Thanx
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now