toolstrip

Detect right click on toolstrip button

萝らか妹 提交于 2019-12-13 21:05:59
问题 I have a toolstrip with a context menu and a toolstrip button in it with a click event. Initially I tried to assign the context menu to the button itself, but couldn't find a context menu in its property. So I assigned the context menu to the toolstrip. Now whenever I right click the button for the context menu to appear, the button click event is triggered. I want to check which mouse button is clicked, so I tired to cast event args to mouseeventargs: if (((MouseEventArgs)e).Button !=

ToolStripDropDownButton equivalent in WPF?

倖福魔咒の 提交于 2019-12-11 01:37:49
问题 I'm very newbie to the WPF technology. I've been developing in WinForms for around 6 years. Now I would like to advance one big step in my skills by learning WPF. I'm reading the introduction guides in MSDN, while as a personal exercise I'm trying to translate the sructure of a WinForms UI to its WPF UI equivalent. This is a simple mockup of the WinForms controls structure that I would like to reproduce in WPF: My problem is trying to reproduce the equivalent control/behavior for the

SourceControl of ContextMenuStrip is Nothing in ToolStripMenuItem Click?

蓝咒 提交于 2019-12-08 12:50:11
问题 I have single ContextMenuStrip attached to more controls. In use the Opening event of ContextMenuStrip to filter/disable some context entries. In this case the property ContexteMenuStrip.SourceControl is set correctly. The problem I have is on the Click event of a ToolStripMenuItem . This item is inside a ToolStripDropDown . I get the parent item with code: Dim tsmi As ToolStripMenuItem = DirectCast(DirectCast(DirectCast(sender, ToolStripMenuItem).Owner, ToolStripDropDown).OwnerItem,

The correct way to get the owner toolstrip of a toolstrip item in .net, winforms

泪湿孤枕 提交于 2019-12-08 03:30:59
问题 I found that while trying to find the owning toolstrip of an item, it wasn't a easy as just looking at the owner of the item. Below is some pseudo code that I think should work. Can anyone see any problems with this or should it work in all cases? (1) Is type of Item.Owner a ToolStrip? (2) Yes, Return Item.Owner (3) No, Item = Item.OwnerItem. Go to (1). ETA: I'd like to make the test a general test. So instead of testing for ToolStrip, I should be testing for ToolStrip, MenuStrip, StatusStrip

Change ToolStripPanel overflow behavior for dynamically added ToolStripItems

北战南征 提交于 2019-12-08 00:53:52
问题 I have a Windows Forms ToolStripPanel that I dynamically add new ToolStrips to it. Each ToolStrip has ToolStripItems that I dynamically add to it (mostly ToolStripButtons). I would like to have all the ToolStrips fit on one row as long as you can see all the ToolStripItems in each ToolStrip. If adding a new ToolStripItem to a ToolStrip causes overflow to occur, I'd like the ToolStrip at the end of the row to jump down to a new row. The only time I'd like to see the overflow button is if the

How to customise rendering of a ToolStripTextBox?

血红的双手。 提交于 2019-12-07 12:22:53
问题 I like the ToolStripProfessionalRenderer style quite a lot, but I do not like the way it renders a ToolStripTextBox. Here, ToolStripSystemRenderer does a better job IMO. Now is there a way to combine both renderers' behaviour to use system style for text boxes and pro style for everything else? I have successfully managed to use pro style for buttons and system style for the rest (by deriving both classes). But text boxes in a ToolStrip don't seem to be handled by the renderer. Using .NET

Why doesn't toolstriplabel's backcolor property change during design time or run time?

情到浓时终转凉″ 提交于 2019-12-07 08:35:36
问题 I need to have a toolstrip label and its back color changed during runtime, but no matter what I do. It just won't change its backcolor, even though they give option to change its backcolor. Why is that and how do you get its backcolor property to change during runtime or design time? Thanks in advance, 回答1: This is affected by the ToolStrip's RenderMode setting. Only when you change it to System will the BackColor property have an effect. The other renderers use theme colors. You are

Change ToolStripPanel overflow behavior for dynamically added ToolStripItems

一世执手 提交于 2019-12-06 05:10:58
I have a Windows Forms ToolStripPanel that I dynamically add new ToolStrips to it. Each ToolStrip has ToolStripItems that I dynamically add to it (mostly ToolStripButtons). I would like to have all the ToolStrips fit on one row as long as you can see all the ToolStripItems in each ToolStrip. If adding a new ToolStripItem to a ToolStrip causes overflow to occur, I'd like the ToolStrip at the end of the row to jump down to a new row. The only time I'd like to see the overflow button is if the ToolStrip has so many items that they can't fit on the width of the form. I want this to be the default

How to customise rendering of a ToolStripTextBox?

吃可爱长大的小学妹 提交于 2019-12-06 03:05:09
I like the ToolStripProfessionalRenderer style quite a lot, but I do not like the way it renders a ToolStripTextBox. Here, ToolStripSystemRenderer does a better job IMO. Now is there a way to combine both renderers' behaviour to use system style for text boxes and pro style for everything else? I have successfully managed to use pro style for buttons and system style for the rest (by deriving both classes). But text boxes in a ToolStrip don't seem to be handled by the renderer. Using .NET Reflector, those text boxes don't even seem to have a Paint event handler, although it's called by the

Showing a tooltip on a non-focused ToolStripItem

落花浮王杯 提交于 2019-12-05 21:17:27
问题 ToolStripItems show Active highlighting when you mouse over them, even if the form they are in is not in focus. They do not, however, show their tooltips, unless the form is focused. I have seen the ToolStrip 'click-though' hack. Anyone know how to make a ToolStripButton show its tooltip when its parent form is not in focus? Thanks! 回答1: The problem is that the ToolStrip "controls" like ToolStripButton or ToolStripDropDownButton don't inherit from Control. For now I addressed the problem by