// There seems to be no public way to set these properties  :/
 internal ToolStripGripRenderEventArgs(Graphics g, ToolStrip toolStrip, Rectangle gripBounds, ToolStripGripDisplayStyle displayStyle, ToolStripGripStyle gripStyle)
     : base(g, toolStrip)
 {
     this.grip_bounds        = gripBounds;
     this.grip_display_style = displayStyle;
     this.grip_style         = gripStyle;
 }
 public ToolStripGripRenderEventArgs(Graphics g, ToolStrip toolStrip)
     : base(g, toolStrip)
 {
     this.grip_bounds        = new Rectangle(2, 0, 3, 25);
     this.grip_display_style = ToolStripGripDisplayStyle.Vertical;
     this.grip_style         = ToolStripGripStyle.Visible;
 }
		// There seems to be no public way to set these properties  :/
		internal ToolStripGripRenderEventArgs (Graphics g, ToolStrip toolStrip, Rectangle gripBounds, ToolStripGripDisplayStyle displayStyle, ToolStripGripStyle gripStyle)
			: base (g, toolStrip)
		{
			this.grip_bounds = gripBounds;
			this.grip_display_style = displayStyle;
			this.grip_style = gripStyle;
		}
		public ToolStripGripRenderEventArgs (Graphics g, ToolStrip toolStrip) 
			: base (g, toolStrip)
		{
			this.grip_bounds = new Rectangle (2, 0, 3, 25);
			this.grip_display_style = ToolStripGripDisplayStyle.Vertical;
			this.grip_style = ToolStripGripStyle.Visible;
		}
示例#5
0
 /// <summary>
 /// Sets the grip style.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetGripStyle(this ToolStrip control, ToolStripGripStyle value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetGripStyle(value)));
     }
     else
     {
         control.GripStyle = value;
         control.Refresh();
     }
 }
示例#6
0
        public void MenuStrip_GripStyle_SetWithHandle_GetReturnsExpected(ToolStripGripStyle value, int expectedLayoutCallCount)
        {
            using var control = new MenuStrip();
            Assert.NotEqual(IntPtr.Zero, control.Handle);
            int invalidatedCallCount = 0;

            control.Invalidated += (sender, e) => invalidatedCallCount++;
            int styleChangedCallCount = 0;

            control.StyleChanged += (sender, e) => styleChangedCallCount++;
            int createdCallCount = 0;

            control.HandleCreated += (sender, e) => createdCallCount++;
            int layoutCallCount = 0;

            control.Layout += (sender, e) =>
            {
                Assert.Same(control, sender);
                Assert.Same(control, e.AffectedControl);
                Assert.Equal("GripStyle", e.AffectedProperty);
                layoutCallCount++;
            };

            control.GripStyle = value;
            Assert.Equal(value, control.GripStyle);
            Assert.Equal(expectedLayoutCallCount, layoutCallCount);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(expectedLayoutCallCount, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);

            // Set same.
            control.GripStyle = value;
            Assert.Equal(value, control.GripStyle);
            Assert.Equal(expectedLayoutCallCount, layoutCallCount);
            Assert.True(control.IsHandleCreated);
            Assert.Equal(expectedLayoutCallCount, invalidatedCallCount);
            Assert.Equal(0, styleChangedCallCount);
            Assert.Equal(0, createdCallCount);
        }
示例#7
0
        public void MenuStrip_GripStyle_Set_GetReturnsExpected(ToolStripGripStyle value, int expectedLayoutCallCount)
        {
            using var control = new MenuStrip();
            int layoutCallCount = 0;

            control.Layout += (sender, e) =>
            {
                Assert.Same(control, sender);
                Assert.Same(control, e.AffectedControl);
                Assert.Equal("GripStyle", e.AffectedProperty);
                layoutCallCount++;
            };

            control.GripStyle = value;
            Assert.Equal(value, control.GripStyle);
            Assert.Equal(expectedLayoutCallCount, layoutCallCount);
            Assert.False(control.IsHandleCreated);

            // Set same.
            control.GripStyle = value;
            Assert.Equal(value, control.GripStyle);
            Assert.Equal(expectedLayoutCallCount, layoutCallCount);
            Assert.False(control.IsHandleCreated);
        }
 public ToolStrip()
 {
     this.hwndThatLostFocus = IntPtr.Zero;
     this.lastInsertionMarkRect = Rectangle.Empty;
     this.toolStripGripStyle = ToolStripGripStyle.Visible;
     this.activeDropDowns = new ArrayList(1);
     this.currentRendererType = typeof(System.Type);
     this.toolStripDropDownDirection = ToolStripDropDownDirection.Default;
     this.largestDisplayedItemSize = Size.Empty;
     this.imageScalingSize = new Size(0x10, 0x10);
     this.mouseEnterWhenShown = InvalidMouseEnter;
     base.SuspendLayout();
     this.CanOverflow = true;
     this.TabStop = false;
     this.MenuAutoExpand = false;
     base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor, true);
     base.SetStyle(ControlStyles.Selectable, false);
     this.SetToolStripState(0xc0, true);
     base.SetState2(0x810, true);
     ToolStripManager.ToolStrips.Add(this);
     this.layoutEngine = new ToolStripSplitStackLayout(this);
     this.Dock = this.DefaultDock;
     this.AutoSize = true;
     this.CausesValidation = false;
     Size defaultSize = this.DefaultSize;
     base.SetAutoSizeMode(AutoSizeMode.GrowAndShrink);
     this.ShowItemToolTips = this.DefaultShowItemToolTips;
     base.ResumeLayout(true);
 }
示例#9
0
文件: ToolStrip.cs 项目: nekresh/mono
		public ToolStrip (params ToolStripItem[] items) : base ()
		{
			SetStyle (ControlStyles.AllPaintingInWmPaint, true);
			SetStyle (ControlStyles.OptimizedDoubleBuffer, true);
			SetStyle (ControlStyles.Selectable, false);
			SetStyle (ControlStyles.SupportsTransparentBackColor, true);

			this.SuspendLayout ();
			
			this.items = new ToolStripItemCollection (this, items, true);
			this.allow_merge = true;
			base.AutoSize = true;
			this.SetAutoSizeMode (AutoSizeMode.GrowAndShrink);
			this.back_color = Control.DefaultBackColor;
			this.can_overflow = true;
			base.CausesValidation = false;
			this.default_drop_down_direction = ToolStripDropDownDirection.BelowRight;
			this.displayed_items = new ToolStripItemCollection (this, null, true);
			this.Dock = this.DefaultDock;
			base.Font = new Font ("Tahoma", 8.25f);
			this.fore_color = Control.DefaultForeColor;
			this.grip_margin = this.DefaultGripMargin;
			this.grip_style = ToolStripGripStyle.Visible;
			this.image_scaling_size = new Size (16, 16);
			this.layout_style = ToolStripLayoutStyle.HorizontalStackWithOverflow;
			this.orientation = Orientation.Horizontal;
			if (!(this is ToolStripDropDown))
				this.overflow_button = new ToolStripOverflowButton (this);
			this.renderer = null;
			this.render_mode = ToolStripRenderMode.ManagerRenderMode;
			this.show_item_tool_tips = this.DefaultShowItemToolTips;
			base.TabStop = false;
			this.text_direction = ToolStripTextDirection.Horizontal;
			this.ResumeLayout ();
			
			// Register with the ToolStripManager
			ToolStripManager.AddToolStrip (this);
		}