4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 // Copyright (c) 2006 Jonathan Pobst
26 // Jonathan Pobst (monkey@jpobst.com)
31 using System.Collections.Generic;
32 using System.ComponentModel;
35 using System.Windows.Forms;
37 using NUnit.Framework;
39 namespace MonoTests.System.Windows.Forms
42 public class ToolStripTests
45 public void Constructor ()
47 ToolStrip ts = new ToolStrip ();
49 Assert.AreEqual (false, ts.AllowDrop, "A1");
50 //Assert.AreEqual (false, ts.AllowItemReorder, "A2");
51 //Assert.AreEqual (true, ts.AllowMerge, "A3");
52 Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, ts.Anchor, "A4");
53 Assert.AreEqual (true, ts.AutoSize, "A5");
54 Assert.AreEqual (SystemColors.Control, ts.BackColor, "A6");
55 Assert.AreEqual (null, ts.BindingContext, "A7");
56 //Assert.AreEqual (true, ts.CanOverflow, "A8");
57 Assert.AreEqual (false, ts.CausesValidation, "A9");
58 Assert.AreEqual (Cursors.Default, ts.Cursor, "A10");
59 //Assert.AreEqual (ToolStripDropDownDirection.BelowRight, ts.DefaultDropDownDirection, "A11");
60 Assert.AreEqual (new Rectangle (7, 0, 92, 25), ts.DisplayRectangle, "A12");
61 Assert.AreEqual (DockStyle.Top, ts.Dock, "A13");
62 Assert.AreEqual (new Font ("Tahoma", 8.25f), ts.Font, "A14");
63 Assert.AreEqual (SystemColors.ControlText, ts.ForeColor, "A15");
64 Assert.AreEqual (ToolStripGripDisplayStyle.Vertical, ts.GripDisplayStyle, "A16");
65 Assert.AreEqual (new Padding (2), ts.GripMargin, "A17");
66 Assert.AreEqual (new Rectangle (2, 0, 3, 25), ts.GripRectangle, "A18");
67 Assert.AreEqual (ToolStripGripStyle.Visible, ts.GripStyle, "A19");
68 Assert.AreEqual (null, ts.ImageList, "A20");
69 Assert.AreEqual (new Size (16, 16), ts.ImageScalingSize, "A21");
70 //Assert.AreEqual (false, ts.IsCurrentlyDragging, "A22");
71 Assert.AreEqual (false, ts.IsDropDown, "A23");
72 Assert.AreEqual ("System.Windows.Forms.ToolStripItemCollection", ts.Items.ToString (), "A24");
73 Assert.AreEqual ("System.Windows.Forms.ToolStripSplitStackLayout", ts.LayoutEngine.ToString (), "A25");
74 Assert.AreEqual (null, ts.LayoutSettings, "A26");
75 Assert.AreEqual (ToolStripLayoutStyle.HorizontalStackWithOverflow, ts.LayoutStyle, "A27");
76 Assert.AreEqual (Orientation.Horizontal, ts.Orientation, "A28");
77 //Assert.AreEqual ("System.Windows.Forms.ToolStripOverflowButton", ts.OverflowButton.ToString (), "A29");
78 Assert.AreEqual ("System.Windows.Forms.ToolStripProfessionalRenderer", ts.Renderer.ToString (), "A30");
79 Assert.AreEqual (ToolStripRenderMode.ManagerRenderMode, ts.RenderMode, "A31");
80 Assert.AreEqual (true, ts.ShowItemToolTips, "A32");
81 Assert.AreEqual (false, ts.Stretch, "A33");
82 Assert.AreEqual (false, ts.TabStop, "A34");
83 //Assert.AreEqual (ToolStripTextDirection.Horizontal, ts.TextDirection, "A35");
85 ts = new ToolStrip (new ToolStripButton (), new ToolStripSeparator (), new ToolStripButton ());
86 Assert.AreEqual (3, ts.Items.Count, "A36");
90 public void ControlStyle ()
92 ExposeProtectedProperties epp = new ExposeProtectedProperties ();
94 ControlStyles cs = ControlStyles.ContainerControl;
95 cs |= ControlStyles.UserPaint;
96 cs |= ControlStyles.StandardClick;
97 cs |= ControlStyles.SupportsTransparentBackColor;
98 cs |= ControlStyles.StandardDoubleClick;
99 cs |= ControlStyles.AllPaintingInWmPaint;
100 cs |= ControlStyles.OptimizedDoubleBuffer;
101 cs |= ControlStyles.UseTextForAccessibility;
103 Assert.AreEqual (cs, epp.GetControlStyles (), "Styles");
107 [NUnit.Framework.Category ("NotWorking")]
108 public void DockSize ()
110 ToolStrip ts = new ToolStrip();
111 Assert.AreEqual (new Size (100, 25), ts.Size, "#1");
112 ts.Dock = DockStyle.None;
113 Assert.AreEqual (new Size (100, 25), ts.Size, "#2");
117 public void ProtectedProperties ()
119 ExposeProtectedProperties epp = new ExposeProtectedProperties ();
121 Assert.AreEqual (DockStyle.Top, epp.DefaultDock, "C1");
122 Assert.AreEqual (new Padding (2), epp.DefaultGripMargin, "C2");
123 Assert.AreEqual (new Padding (0), epp.DefaultMargin, "C3");
124 Assert.AreEqual (new Padding (0,0,1,0), epp.DefaultPadding, "C4");
125 Assert.AreEqual (true, epp.DefaultShowItemToolTips, "C5");
126 Assert.AreEqual (new Size (100, 25), epp.DefaultSize, "C6");
127 //Assert.AreEqual (new Size (92, 25), epp.MaxItemSize, "C7");
131 public void PropertyAllowDrop ()
133 ToolStrip ts = new ToolStrip ();
134 EventWatcher ew = new EventWatcher (ts);
137 Assert.AreEqual (true, ts.AllowDrop, "B1");
138 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
142 //public void PropertyAllowItemReorder ()
144 // ToolStrip ts = new ToolStrip ();
145 // EventWatcher ew = new EventWatcher (ts);
147 // ts.AllowItemReorder = true;
148 // Assert.AreEqual (true, ts.AllowItemReorder, "B1");
149 // Assert.AreEqual (string.Empty, ew.ToString (), "B2");
153 //[ExpectedException (typeof (ArgumentException))]
154 //public void PropertyAllowDropAndAllowItemReorderAE ()
156 // ToolStrip ts = new ToolStrip ();
157 // EventWatcher ew = new EventWatcher (ts);
159 // ts.AllowDrop = true;
160 // ts.AllowItemReorder = true;
164 //[ExpectedException (typeof (ArgumentException))]
165 //public void PropertyAllowDropAndAllowItemReorderAE2 ()
167 // ToolStrip ts = new ToolStrip ();
168 // EventWatcher ew = new EventWatcher (ts);
170 // ts.AllowItemReorder = true;
171 // ts.AllowDrop = true;
175 //public void PropertyAllowMerge ()
177 // ToolStrip ts = new ToolStrip ();
178 // EventWatcher ew = new EventWatcher (ts);
180 // ts.AllowMerge = false;
181 // Assert.AreEqual (false, ts.AllowMerge, "B1");
182 // Assert.AreEqual (string.Empty, ew.ToString (), "B2");
186 public void PropertyAnchorAndDocking ()
188 ToolStrip ts = new ToolStrip ();
190 ts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
192 Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Bottom, ts.Anchor, "A1");
193 Assert.AreEqual (DockStyle.None, ts.Dock, "A2");
194 Assert.AreEqual (Orientation.Horizontal, ts.Orientation, "A3");
196 ts.Anchor = AnchorStyles.Left | AnchorStyles.Right;
198 Assert.AreEqual (AnchorStyles.Left | AnchorStyles.Right, ts.Anchor, "A1");
199 Assert.AreEqual (DockStyle.None, ts.Dock, "A2");
200 Assert.AreEqual (Orientation.Horizontal, ts.Orientation, "A3");
202 ts.Dock = DockStyle.Left;
204 Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, ts.Anchor, "A1");
205 Assert.AreEqual (DockStyle.Left, ts.Dock, "A2");
206 Assert.AreEqual (Orientation.Vertical, ts.Orientation, "A3");
208 ts.Dock = DockStyle.None;
210 Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, ts.Anchor, "A1");
211 Assert.AreEqual (DockStyle.None, ts.Dock, "A2");
212 Assert.AreEqual (Orientation.Horizontal, ts.Orientation, "A3");
214 ts.Dock = DockStyle.Top;
216 Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, ts.Anchor, "A1");
217 Assert.AreEqual (DockStyle.Top, ts.Dock, "A2");
218 Assert.AreEqual (Orientation.Horizontal, ts.Orientation, "A3");
222 public void PropertyAutoSize ()
224 ToolStrip ts = new ToolStrip ();
225 EventWatcher ew = new EventWatcher (ts);
228 Assert.AreEqual (false, ts.AutoSize, "B1");
229 Assert.AreEqual ("AutoSizeChanged", ew.ToString (), "B2");
233 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
237 public void PropertyBackColor ()
239 ToolStrip ts = new ToolStrip ();
240 EventWatcher ew = new EventWatcher (ts);
242 ts.BackColor = Color.BurlyWood;
243 Assert.AreEqual (Color.BurlyWood, ts.BackColor, "B1");
244 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
248 public void PropertyBindingContext ()
250 ToolStrip ts = new ToolStrip ();
251 EventWatcher ew = new EventWatcher (ts);
253 BindingContext b = new BindingContext ();
254 ts.BindingContext = b;
255 Assert.AreSame (b, ts.BindingContext, "B1");
256 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
260 //public void PropertyCanOverflow ()
262 // ToolStrip ts = new ToolStrip ();
263 // EventWatcher ew = new EventWatcher (ts);
265 // ts.CanOverflow = false;
266 // Assert.AreEqual (false, ts.CanOverflow, "B1");
267 // Assert.AreEqual (string.Empty, ew.ToString (), "B2");
271 public void PropertyCausesValidation ()
273 ToolStrip ts = new ToolStrip ();
274 EventWatcher ew = new EventWatcher (ts);
276 ts.CausesValidation = true;
277 Assert.AreEqual (true, ts.CausesValidation, "B1");
278 Assert.AreEqual ("CausesValidationChanged", ew.ToString (), "B2");
281 ts.CausesValidation = true;
282 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
286 public void PropertyCursor ()
288 ToolStrip ts = new ToolStrip ();
289 EventWatcher ew = new EventWatcher (ts);
291 ts.Cursor = Cursors.Cross;
292 Assert.AreEqual (Cursors.Cross, ts.Cursor, "B1");
293 Assert.AreEqual ("CursorChanged", ew.ToString (), "B2");
296 ts.Cursor = Cursors.Cross;
297 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
301 //public void PropertyDefaultDropDownDirection ()
303 // ToolStrip ts = new ToolStrip ();
304 // EventWatcher ew = new EventWatcher (ts);
306 // ts.DefaultDropDownDirection = ToolStripDropDownDirection.AboveLeft;
307 // Assert.AreEqual (ToolStripDropDownDirection.AboveLeft, ts.DefaultDropDownDirection, "B1");
308 // Assert.AreEqual (string.Empty, ew.ToString (), "B2");
312 //[ExpectedException (typeof (InvalidEnumArgumentException))]
313 //public void PropertyDefaultDropDownDirectionIEAE ()
315 // ToolStrip ts = new ToolStrip ();
316 // EventWatcher ew = new EventWatcher (ts);
318 // ts.DefaultDropDownDirection = (ToolStripDropDownDirection) 42;
322 [ExpectedException (typeof (InvalidEnumArgumentException))]
323 public void PropertyDockIEAE ()
325 ToolStrip ts = new ToolStrip ();
326 ts.Dock = (DockStyle)42;
330 public void PropertyFont ()
332 ToolStrip ts = new ToolStrip ();
333 EventWatcher ew = new EventWatcher (ts);
335 Font f = new Font ("Arial", 12);
338 Assert.AreSame (f, ts.Font, "B1");
339 Assert.AreEqual ("LayoutCompleted", ew.ToString (), "B2");
343 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
347 public void PropertyForeColor ()
349 ToolStrip ts = new ToolStrip ();
350 EventWatcher ew = new EventWatcher (ts);
352 ts.ForeColor = Color.BurlyWood;
353 Assert.AreEqual (Color.BurlyWood, ts.ForeColor, "B1");
354 Assert.AreEqual ("ForeColorChanged", ew.ToString (), "B2");
357 ts.ForeColor = Color.BurlyWood;
358 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
362 public void PropertyGripMargin ()
364 ToolStrip ts = new ToolStrip ();
365 EventWatcher ew = new EventWatcher (ts);
367 ts.GripMargin = new Padding (6);
368 Assert.AreEqual (new Padding (6), ts.GripMargin, "B1");
369 Assert.AreEqual ("LayoutCompleted", ew.ToString (), "B2");
372 ts.GripMargin = new Padding (6);
373 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
377 public void PropertyGripStyle ()
379 ToolStrip ts = new ToolStrip ();
380 EventWatcher ew = new EventWatcher (ts);
382 ts.GripStyle = ToolStripGripStyle.Hidden;
383 Assert.AreEqual (ToolStripGripStyle.Hidden, ts.GripStyle, "B1");
384 Assert.AreEqual ("LayoutCompleted", ew.ToString (), "B2");
387 ts.GripStyle = ToolStripGripStyle.Hidden;
388 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
392 [ExpectedException (typeof (InvalidEnumArgumentException))]
393 public void PropertyGripStyleIEAE ()
395 ToolStrip ts = new ToolStrip ();
397 ts.GripStyle = (ToolStripGripStyle) 42;
401 public void PropertyImageList ()
403 ToolStrip ts = new ToolStrip ();
404 EventWatcher ew = new EventWatcher (ts);
406 ImageList il = new ImageList ();
409 Assert.AreSame (il, ts.ImageList, "B1");
410 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
414 public void PropertyImageScalingSize ()
416 ToolStrip ts = new ToolStrip ();
417 EventWatcher ew = new EventWatcher (ts);
419 ts.ImageScalingSize = new Size (32, 32);
420 Assert.AreEqual (new Size (32, 32), ts.ImageScalingSize, "B1");
421 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
425 public void PropertyLayoutStyle ()
427 ToolStrip ts = new ToolStrip ();
428 EventWatcher ew = new EventWatcher (ts);
430 ts.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow;
431 Assert.AreEqual (ToolStripLayoutStyle.VerticalStackWithOverflow, ts.LayoutStyle, "B1");
432 Assert.AreEqual ("LayoutCompleted;LayoutStyleChanged", ew.ToString (), "B2");
435 ts.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow;
436 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
440 [ExpectedException (typeof (InvalidEnumArgumentException))]
441 public void PropertyLayoutStyleIEAE ()
443 ToolStrip ts = new ToolStrip ();
445 ts.LayoutStyle = (ToolStripLayoutStyle) 42;
449 public void PropertyRenderer ()
451 ToolStrip ts = new ToolStrip ();
452 EventWatcher ew = new EventWatcher (ts);
454 ToolStripProfessionalRenderer pr = new ToolStripProfessionalRenderer ();
457 Assert.AreSame (pr, ts.Renderer, "B1");
458 Assert.AreEqual ("LayoutCompleted;RendererChanged", ew.ToString (), "B2");
459 Assert.AreEqual (ToolStripRenderMode.Custom, ts.RenderMode, "B4");
463 Assert.AreEqual (string.Empty, ew.ToString (), "B3");
467 public void PropertyRenderMode ()
469 ToolStrip ts = new ToolStrip ();
470 EventWatcher ew = new EventWatcher (ts);
472 ts.RenderMode = ToolStripRenderMode.System;
473 Assert.AreEqual (ToolStripRenderMode.System, ts.RenderMode, "B1");
474 Assert.AreEqual ("LayoutCompleted;RendererChanged", ew.ToString (), "B2");
477 ts.RenderMode = ToolStripRenderMode.System;
478 Assert.AreEqual ("LayoutCompleted;RendererChanged", ew.ToString (), "B3");
482 [ExpectedException (typeof (NotSupportedException))]
483 public void PropertyRenderModeNSE ()
485 ToolStrip ts = new ToolStrip ();
487 ts.RenderMode = ToolStripRenderMode.Custom;
491 [ExpectedException (typeof (InvalidEnumArgumentException))]
492 public void PropertyRenderModeIEAE ()
494 ToolStrip ts = new ToolStrip ();
496 ts.RenderMode = (ToolStripRenderMode) 42;
500 public void PropertyShowItemToolTips ()
502 ToolStrip ts = new ToolStrip ();
503 EventWatcher ew = new EventWatcher (ts);
505 ts.ShowItemToolTips = false;
506 Assert.AreEqual (false, ts.ShowItemToolTips, "B1");
507 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
511 public void PropertyStretch ()
513 ToolStrip ts = new ToolStrip ();
514 EventWatcher ew = new EventWatcher (ts);
517 Assert.AreEqual (true, ts.Stretch, "B1");
518 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
522 public void PropertyTabStop ()
524 ToolStrip ts = new ToolStrip ();
525 EventWatcher ew = new EventWatcher (ts);
528 Assert.AreEqual (true, ts.TabStop, "B1");
529 Assert.AreEqual (string.Empty, ew.ToString (), "B2");
533 //public void PropertyTextDirection ()
535 // ToolStrip ts = new ToolStrip ();
536 // EventWatcher ew = new EventWatcher (ts);
538 // ts.TextDirection = ToolStripTextDirection.Vertical270;
539 // Assert.AreEqual (ToolStripTextDirection.Vertical270, ts.TextDirection, "B1");
540 // Assert.AreEqual ("LayoutCompleted", ew.ToString (), "B2");
543 // ts.TextDirection = ToolStripTextDirection.Vertical270;
544 // Assert.AreEqual ("LayoutCompleted", ew.ToString (), "B3");
548 //[ExpectedException (typeof (InvalidEnumArgumentException))]
549 //public void PropertyTextDirectionIEAE ()
551 // ToolStrip ts = new ToolStrip ();
552 // EventWatcher ew = new EventWatcher (ts);
554 // ts.TextDirection = (ToolStripTextDirection) 42;
558 public void TestToolStrip ()
560 ToolStrip ts = new ToolStrip ();
562 ts.Items.Add (new ToolStripButton ());
563 Assert.AreEqual (new Rectangle (0, 0, 100, 25), ts.Bounds, "D1");
564 Assert.AreEqual (new Rectangle (7, 0, 92, 25), ts.DisplayRectangle, "D2");
565 Assert.AreEqual (new Rectangle (2, 0, 3, 25), ts.GripRectangle, "D4");
566 Assert.AreEqual (new Padding (2), ts.GripMargin, "D5");
568 ts.GripStyle = ToolStripGripStyle.Hidden;
570 Assert.AreEqual (new Rectangle (0, 0, 0, 0), ts.GripRectangle, "D8");
571 Assert.AreEqual (new Rectangle (0, 0, 99, 25), ts.DisplayRectangle, "D3");
572 Assert.AreEqual (new Padding (2), ts.GripMargin, "D5");
574 ts.BackColor = Color.Aquamarine;
575 Assert.AreEqual (Color.Aquamarine, ts.BackColor, "A2");
577 ts.ForeColor = Color.LightSalmon;
578 Assert.AreEqual (Color.LightSalmon, ts.ForeColor, "A5");
580 ts.GripMargin = new Padding (3);
581 Assert.AreEqual (new Padding (3), ts.GripMargin, "A7");
585 [Ignore ("Accessibility still needs some work")]
586 public void Accessibility ()
588 ToolStrip ts = new ToolStrip ();
589 AccessibleObject ao = ts.AccessibilityObject;
591 Assert.AreEqual ("ControlAccessibleObject: Owner = " + ts.ToString (), ao.ToString (), "L");
592 //Assert.AreEqual (Rectangle.Empty, ao.Bounds, "L1");
593 Assert.AreEqual (null, ao.DefaultAction, "L2");
594 Assert.AreEqual (null, ao.Description, "L3");
595 Assert.AreEqual (null, ao.Help, "L4");
596 Assert.AreEqual (null, ao.KeyboardShortcut, "L5");
597 Assert.AreEqual (null, ao.Name, "L6");
598 //Assert.AreEqual (null, ao.Parent, "L7");
599 Assert.AreEqual (AccessibleRole.ToolBar, ao.Role, "L8");
600 Assert.AreEqual (AccessibleStates.None, ao.State, "L9");
601 Assert.AreEqual (null, ao.Value, "L10");
604 ts.Text = "Test Label";
605 ts.AccessibleDescription = "Label Desc";
607 //Assert.AreEqual (Rectangle.Empty, ao.Bounds, "L11");
608 Assert.AreEqual (null, ao.DefaultAction, "L12");
609 Assert.AreEqual ("Label Desc", ao.Description, "L13");
610 Assert.AreEqual (null, ao.Help, "L14");
611 Assert.AreEqual (null, ao.KeyboardShortcut, "L15");
612 //Assert.AreEqual ("Test Label", ao.Name, "L16");
613 //Assert.AreEqual (null, ao.Parent, "L17");
614 Assert.AreEqual (AccessibleRole.ToolBar, ao.Role, "L18");
615 Assert.AreEqual (AccessibleStates.None, ao.State, "L19");
616 Assert.AreEqual (null, ao.Value, "L20");
618 ts.AccessibleName = "Access Label";
619 Assert.AreEqual ("Access Label", ao.Name, "L21");
621 ts.Text = "Test Label";
622 Assert.AreEqual ("Access Label", ao.Name, "L22");
624 ts.AccessibleDefaultActionDescription = "AAA";
625 Assert.AreEqual ("AAA", ts.AccessibleDefaultActionDescription, "L23");
628 private class EventWatcher
630 private string events = string.Empty;
632 public EventWatcher (ToolStrip ts)
634 ts.AutoSizeChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("AutoSizeChanged;"); });
635 //ts.BeginDrag += new EventHandler (delegate (Object obj, EventArgs e) { events += ("BeginDrag;"); });
636 ts.CausesValidationChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("CausesValidationChanged;"); });
637 ts.CursorChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("CursorChanged;"); });
638 //ts.EndDrag += new EventHandler (delegate (Object obj, EventArgs e) { events += ("EndDrag;"); });
639 ts.ForeColorChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("ForeColorChanged;"); });
640 ts.ItemAdded += new ToolStripItemEventHandler (delegate (Object obj, ToolStripItemEventArgs e) { events += ("ItemAdded;"); });
641 ts.ItemClicked += new ToolStripItemClickedEventHandler (delegate (Object obj, ToolStripItemClickedEventArgs e) { events += ("ItemClicked;"); });
642 ts.ItemRemoved += new ToolStripItemEventHandler (delegate (Object obj, ToolStripItemEventArgs e) { events += ("ItemRemoved;"); });
643 ts.LayoutCompleted += new EventHandler (delegate (Object obj, EventArgs e) { events += ("LayoutCompleted;"); });
644 ts.LayoutStyleChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("LayoutStyleChanged;"); });
645 ts.PaintGrip += new PaintEventHandler (delegate (Object obj, PaintEventArgs e) { events += ("PaintGrip;"); });
646 ts.RendererChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("RendererChanged;"); });
649 public override string ToString ()
651 return events.TrimEnd (';');
656 events = string.Empty;
660 private class ExposeProtectedProperties : ToolStrip
662 public new DockStyle DefaultDock { get { return base.DefaultDock; } }
663 public new Padding DefaultGripMargin { get { return base.DefaultGripMargin; } }
664 public new Padding DefaultMargin { get { return base.DefaultMargin; } }
665 public new Padding DefaultPadding { get { return base.DefaultPadding; } }
666 public new bool DefaultShowItemToolTips { get { return base.DefaultShowItemToolTips; } }
667 public new Size DefaultSize { get { return base.DefaultSize; } }
668 //public new Size MaxItemSize { get { return base.MaxItemSize; } }
670 public ControlStyles GetControlStyles ()
672 ControlStyles retval = (ControlStyles) 0;
674 foreach (ControlStyles cs in Enum.GetValues (typeof (ControlStyles)))
675 if (this.GetStyle (cs) == true)