In this case, find the DropDown property of your dropdownbutton and cast it to ToolStripDropDownMenu, then set ShowImageMargin property of it to false and BackColor of it to the color you want (blue). There is also an alternative solution that is applicable if you don't want to use images in your menu items. ToolStripManager.Renderer = new ToolStripProfessionalRenderer(new CustomColorTable()) Public override Color ToolStripDropDownBackgroundįorm Load Code private void Form_Load(object sender, EventArgs e) ![]() Public override Color ImageMarginGradientEnd Public override Color ImageMarginGradientMiddle Public override Color ImageMarginGradientBegin In your Form Load event set Renderer property of ToolStripManager to use a ToolStripProfessionalRenderer that uses your CustomColorTable.ĬustomColorTable Code public class CustomColorTable:ProfessionalColorTable.Override ImageMarginGradientBegin, ImageMarginGradientMiddle, ImageMarginGradientEnd, ToolStripDropDownBackground and return the color you want (blue).from.Create a CustomColorTable class Inheriting from ProfessionalColorTable.Put a ToolStrip on your form and add DropDownButton and its sub items to it, and Set ForeColor of sub items to White.You can do it by implementing your custom color table that inherits ProfessionalColorTable and overriding correct properties. To Change the border color it is enough to follow Plutonix solution that is described in accepted answer.īut to remove that white border between the item and menu border, you should follow one of these solution: Solution 1 You might also change or disable any Theme to see if that might be causing adverse effects. You might also check that you are using a MenuStrip for the menu, Net does have another (older) menu class though you have to go searching to find it. If you are having trouble getting your overrides to work, check that you are using the right ones (or that they mean what the name implies, some are misleading at first). With the mouse over one of the items (mouse not shown), the item uses the MenuItemSelected color which was Consilk. When open, the menu border is Fuschia (mmmm, soothing!) The menu gradient goes from AliceBlue to DodgerBlue an item with the mouse over it uses a top to bottom gradient of LawnGreen to MediumSeaGreen (mouse not shown). (Though, MenuBorder does seem to work no matter what.) Otherwise, results are as expected: The default should be false whether visual styles are enabled or not, but maybe something else has changed it? base.UseSystemColors = false īoth EnableVisualStyles() and UseSystemColors = false have to be in place for all the rendering elements in your color table to be implemented, otherwise only some are used. You may want to also disable system colors as shown in the ctor. You enable visual styles in Main(): // must be done before any UI elements are used If visual styles are not turned on, not all the color table items will be used and some SystemColors will be used instead. In form load: menuStrip1.Renderer = new ToolStripProfessionalRenderer(new MenuColorTable()) Public override Color MenuStripGradientEnd Public override Color MenuStripGradientBegin Public override Color MenuItemSelectedGradientEnd ![]() Public override Color MenuItemSelectedGradientBegin ![]() A class which inherits from ProfessionalColorTable works as expected: class MenuColorTable : ProfessionalColorTable Disable the grid default context menu for data rows by setting the AllowCellContextMenu to false and use the MouseDown event to show the strip.Is it possible to change the border color of a toolstrip menu dropdown list. ![]() Having this in mind, in order to achieve scenario, you have to options:ġ. With the recent changes we introduced, what we did is to show the ContextMenu/ContextMenuStrip assigned to the control, only the grid context menus are disabled - AllowColumnHeaderContextMenu and AllowCellContextMenu. Perhaps, if your ContextMenuStrip was big enough, it was covering the grid's context menu and you were not able to see it. If this is the case, and the code you showed below is what you used with version Q1 2014, I think that you had two context menus showing when you click on a data row (and new row as well for that matter). Your goal is to show the built-in RadGridView context menu for filtering and header rows, while, for data rows, you would like to show your own ContextMenuStrip? Is that correct and is there is anything else besides this? Let me iterate your requirement, in order to make sure we are on the same page.
0 Comments
Leave a Reply. |