12-17-2006 09:17 PM
12-18-2006 08:07 AM
Howdy Adamhb,
Measurement Studio 8.1 just released which included a new awesome feature just like the one you are describing. We introduced the Instrument Control Strip Control which can be used to display a set of Measurement Studio property edtior controls through the ToolStripPropertyEditor. This new feature in only available for use with Measurement Studio support for Visual Studio 2005.
You can find a demo of this new feature on here. If you have Measurement Studio 8.1 for Visual Studio 2005, you can find an example of this feature in the <MeasurementStudioVS2005>\DotNET\Examples\UI\WindowsForms\InstrumentControlStrip directory.
Best Regards,
12-18-2006 08:33 AM
Hi adamhb,
I just noticed that you also posted some questions regarding the instrument control strip control so I assume you already know about this feature. As far as being able to insert a PropertyEditor control into a ContextMenuStrip control, my initial thoughts are that this is not possible but I am not absolutely sure. I need to check into this and see what options are available with the ContextMenuStrip.
If it turns out that this is not possible, I would definitely submit a product suggestion on this.
Best Regards,
12-18-2006 10:59 AM
Hi adamhb,
I just tested out the ability to add a PropertyEditor control to the ContextMenuStrip control and it is possible. However, you must use the ToolStripPropertyEditor class since the ContextMenuStrip is looking for ToolStripItem objects. For example, you could say
ToolStripPropertyEditor
mylinecolor = new ToolStripPropertyEditor();mylinecolor.Source = new PropertyEditorSource(sampleWaveformPlot, "LineColor");
contextMenuStrip1.Items.Add(mylinecolor);
I used this text code in the Instrument Control Strip Features example mentioned earlier.
Best Regards,
12-18-2006 06:27 PM
12-18-2006 06:45 PM
12-19-2006 11:08 AM
Hi adamhb,
I googled and looked into the Visual Studio documentation and couldn't find any properties for the ContextMenuStrip control that allows you to have multiple ToolStripItem objects on one line. It appears that this might be a limitation of the ContextMenuStrip control, but perhaps I missed some property. I did notice the ToolStrip control as well as our Instrument Control Strip Control puts all the objects on one line. You can notice this behavior if you look at the Features shipping example mentioned earlier. The toolstrip across the top contains a bunch of items (so many that it has a drop down menu at the end). If you look at the drop menu at edit time, you notice the items are all on different lines. However at run-time, some of the items are side by side. See attached screenshots "Design Time.jpg" and "Run Time.jpg".
You might want to do some further research into seeing if multiple ToolStripItem objects on one line in a ContextMenuStrip control is available. I would look at the Visual Studio documentation as well as do some further googling.
Best Regards,
12-19-2006 11:42 AM - edited 12-19-2006 11:42 AM
You might be interested in knowing that we are working to make it easy to use PropertyEditor controls in the ContextMenuStrip and other ToolStrip derived controls easier at design-time for a future release of Measurement Studio.
Regarding placing a label control next to the ToolStripPropertyEditor, it can be done but the effort involved is not trivial. In order to accomplish this, you will need to implement your own layout engine for the ContextMenuStrip. In the .NET Framework, Microsoft has chosen to make implementations of the LayoutEngine (used to layout the items in the ContextMenuStrip) internal. The ContextMenuStrip uses an instance of the internal FlowLayout class that uses the maximum width of all the items to determine the width of the ContextMenuStrip. As the FlowLayout class is internal, you are going to have to completely re-implement its logic while adding yours to the mix. You will then need to derive a class from ContextMenuStrip and override the LayoutEngine property to return an instance of your layout engine.
The next best option I see is to use the MenuItem control in the ContextMenuStrip. MenuItem allows you to provide nested menus in the context menu. You can set the Text property of the MenuItem to "Line Color" and add the PropertyEditor to the DropDownItems collection of the MenuItem instead.
Message Edited by Abhishek Ghuwalewala on 12-19-2006 11:42 AM
12-19-2006 10:16 PM