473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ContextMenu modifications

Kevinyy
77
How do you change the padding, it seems they are locked to 8,2,1,2...
also, how do you "skin" the contextmenustip/contents? I've searched around on google for a bit, but they dont seem to have what im looking for =\

C#.Net 2.2
Aug 16 '08 #1
7 1608
cloud255
427 Expert 256MB
Hi there,

you could try to override the paint event of your context menu and then access the padding property:

Expand|Select|Wrap|Line Numbers
  1. this.Padding = System.Windows.Forms.Padding
it would appear that this doesnt allow you to provide explicit values, but it does allow you to add or subtract 2 padding values. Thus you could define 2 padding values:

Expand|Select|Wrap|Line Numbers
  1. System.Windows.Forms.Padding p1 = new Padding(1,2,3,4);
and then use these values in the calculation and gain a specific result.

for the style you could try:

Expand|Select|Wrap|Line Numbers
  1. contextMenuStrip1.LayoutStyle = somestyle;
the deafult styles are found in ToolStripLayoutStyle, but i doubt that this is what you want. Short of creating a windows theme, i think you could play with the font, backcolor, width etc. to create your desired effect.

Good luck.
Aug 16 '08 #2
Kevinyy
77
The padding still will not change...it reverts back to (8,1,2,1)..
Aug 16 '08 #3
cloud255
427 Expert 256MB
Could you post the code so that we can have a look at it?
Aug 17 '08 #4
Kevinyy
77
Could you post the code so that we can have a look at it?
in the properties...it does not let you adjust it. i tried the lines your suggested and that doesnt work.
Aug 17 '08 #5
Kevinyy
77
bump.....im still having trouble with this :(
Aug 18 '08 #6
joedeene
583 512MB
i think the context menu strip auto configures itself right before the right-click(to activate it) and it sets itself to the size(padding), that it needs for the longest, text on the contextmenustrip? i dont think you can change it, ya i dont think so, maybe take a look at this on MSDN http://msdn.microsoft.com/en-us/libr...l.padding.aspx

here ya go,
joedeene
Aug 18 '08 #7
Kevinyy
77
Ive tried many many things now, what i would like to do is Change the padding on a contextmenustrip. ive read the toolstriprenderer but that seems really confusing and idk if it can help me with what im doing...
Aug 19 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: MD | last post by:
I have a ContextMenu that is assigned to 3 RichTextBox's (i.e., if you right-click on any of the 3 RichTextBox's, you get the same ContextMenu). My ContextMenu has 2 items, each of which have their...
2
by: Derrick | last post by:
I've been working on an application which has a NotifyIcon (system tray icon), and a corresponding ContextMenu. I want to be able to update this menu dynamically. However, when I make changes to...
11
by: Graham Charles | last post by:
I'm writing a control inheriting from ComboBox, and I'd like to add an entry to the ContextMenu for that combo box. I have no problem if I create an entirely new ContextMenu from scratch, but I'd...
3
by: Libby Sharf | last post by:
Hello, I have several ContextMenus and I want to connect them to the GridControl's ContextMenu property depending on the row that was right clicked. Is there an event that is raised just before...
3
by: asharda | last post by:
Hi, I am trying to create a context menu in my application. The context menu takes menu otems from an XML file. In XAML the code is <Grid.ContextMenu> <ContextMenu Name="cm" StaysOpen="true"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.