public static ToolStrip layoutStyle(this ToolStrip toolStrip, ToolStripLayoutStyle layoutStyle) { return(toolStrip.invokeOnThread( () => { toolStrip.LayoutStyle = layoutStyle; return toolStrip; })); }
protected override LayoutSettings CreateLayoutSettings(ToolStripLayoutStyle style) { LayoutSettings layout_settings = base.CreateLayoutSettings(style); if (style == ToolStripLayoutStyle.Flow) { ((FlowLayoutSettings)layout_settings).FlowDirection = FlowDirection.TopDown; } return(layout_settings); }
protected override LayoutSettings CreateLayoutSettings(ToolStripLayoutStyle style) { LayoutSettings layout_settings = base.CreateLayoutSettings(style); if (style == ToolStripLayoutStyle.Flow) { ((FlowLayoutSettings)layout_settings).FlowDirection = FlowDirection.LeftToRight; ((FlowLayoutSettings)layout_settings).WrapContents = true; } return(layout_settings); }
/// <summary> /// Sets the layout style. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> public static void SetLayoutStyle(this ToolStrip control, ToolStripLayoutStyle value) { if (control.InvokeRequired) { control.BeginInvoke(new MethodInvoker(() => control.SetLayoutStyle(value))); } else { control.LayoutStyle = value; control.Refresh(); } }
internal void OnSizeChanged(int width, int height) { if (!HasToolbar) { return; } var ts = this.Content as ToolStrip; Size p = ts.PreferredSize; var oldLS = ts.LayoutStyle; ToolStripLayoutStyle newLS = oldLS; int k; _minWidth = _minHeight = 12; if (ts.Orientation == Orientation.Vertical) { k = _minWidth = p.Width; } else { k = _minHeight = p.Height; } k *= 2; if (width > k && height > k) { newLS = ToolStripLayoutStyle.Flow; } else if (width > k) { newLS = ToolStripLayoutStyle.HorizontalStackWithOverflow; } else if (height > k) { newLS = ToolStripLayoutStyle.VerticalStackWithOverflow; } if (newLS != oldLS) { ts.LayoutStyle = newLS; } }
void _toolstrip_EndDrag_(object sender, EventArgs e) { //if (parent == _toolstrip.Parent) //{ parent = _toolstrip.Parent; parentrect = parent.RectangleToScreen(parent.ClientRectangle); Point ShowLocation = Cursor.Position; // フローティング開始 if (!CheckCloss(parentrect, ShowLocation)) { _showing = true; ToolStripPanel tsp = (ToolStripPanel)_toolstrip.Parent; Point lp = _toolstrip.Location; ToolStripLayoutStyle tsls = _toolstrip.LayoutStyle; form = new FloatingWindow(_toolstrip, _parentpanels, _parentform, text, this); form.rectform.EdgeColor = EdgeColor; form.rectform.BackColor = RangeColor; form.LastParent = tsp; form.LastPoint = lp; form.LastStyle = tsls; _parentform.AddOwnedForm(form); //form.Show(); //MessageBox.Show(ShowLocation.ToString()); /*this.Location = ShowLocation; * _toolstrip.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow; * this.Size = new Size(_toolstrip.Width + GetSystemMetrics(SystemMetric.SM_CXSIZEFRAME) * 2, * _toolstrip.Height /*+ 20 + GetSystemMetrics(SystemMetric.SM_CXSIZEFRAME) * 2); * this.Controls.Add(_toolstrip); * _toolstrip.Location = new Point(0, 20); * //_toolstrip.Dock = DockStyle.Top; * this.Show();*/ } //} }
private void FreeToolStrip(ToolStrip ts) { _originalDock = ts.Dock; _originalLayout = ts.LayoutStyle; TopFormBase frm = new TopFormBase(); frm.Text = "工具栏..."; frm.Tag = ts; frm.FormBorderStyle = FormBorderStyle.SizableToolWindow; frm.BackColor = Color.Gray; switch (ts.Dock) { case DockStyle.Left: case DockStyle.Right: frm.Width = ts.Width * 2 + 8; ts.Dock = DockStyle.Fill; ts.LayoutStyle = ToolStripLayoutStyle.Flow; foreach (ToolStripItem it in ts.Items) { if (it is ToolStripSeparator) { it.Visible = false; } } break; case DockStyle.Top: case DockStyle.Bottom: frm.ClientSize = new Size(frm.Width, ts.Height); ts.Dock = DockStyle.Top; break; } frm.Controls.Add(ts); frm.Show(MainForm); frm.FormClosed += new FormClosedEventHandler(frm_FormClosed); }
public ToolStripLayoutData(ToolStrip toolStrip) { _layoutStyle = toolStrip.LayoutStyle; _autoSize = toolStrip.AutoSize; _size = toolStrip.Size; }
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); }
protected virtual LayoutSettings CreateLayoutSettings (ToolStripLayoutStyle layoutStyle) { switch (layoutStyle) { case ToolStripLayoutStyle.Flow: return new FlowLayoutSettings (this); case ToolStripLayoutStyle.Table: //return new TableLayoutSettings (); case ToolStripLayoutStyle.StackWithOverflow: case ToolStripLayoutStyle.HorizontalStackWithOverflow: case ToolStripLayoutStyle.VerticalStackWithOverflow: default: return null; } }
public LayoutSettings PublicCreateLayoutSettings(ToolStripLayoutStyle style) { return(base.CreateLayoutSettings(style)); }
public ToolStripLayoutData(ToolStrip toolStrip) { this.layoutStyle = toolStrip.LayoutStyle; this.autoSize = toolStrip.AutoSize; this.size = toolStrip.Size; }
protected override LayoutSettings CreateLayoutSettings(ToolStripLayoutStyle style) { return(base.CreateLayoutSettings(style)); }
public ToolStripLayoutData(ToolStrip toolStrip) { this.layoutStyle = toolStrip.LayoutStyle; this.autoSize = toolStrip.AutoSize; this.size = toolStrip.Size; }
public ToolStripDropDownMenu () : base () { this.layout_style = ToolStripLayoutStyle.Flow; this.show_image_margin = true; }
protected override LayoutSettings CreateLayoutSettings(ToolStripLayoutStyle style) { throw null; }
protected virtual LayoutSettings CreateLayoutSettings(ToolStripLayoutStyle layoutStyle) { throw null; }
protected override LayoutSettings CreateLayoutSettings(ToolStripLayoutStyle style) { LayoutSettings settings = base.CreateLayoutSettings(style); if (style == ToolStripLayoutStyle.Flow) { FlowLayoutSettings settings2 = settings as FlowLayoutSettings; settings2.FlowDirection = FlowDirection.TopDown; settings2.WrapContents = false; return settings2; } return settings; }
protected virtual System.Windows.Forms.LayoutSettings CreateLayoutSettings(ToolStripLayoutStyle layoutStyle) { switch (layoutStyle) { case ToolStripLayoutStyle.Flow: return new FlowLayoutSettings(this); case ToolStripLayoutStyle.Table: return new TableLayoutSettings(this); } return null; }
public void ToolStrip_CreateLayoutSettings_InvalidLayoutStyle_ReturnsNull(ToolStripLayoutStyle layoutStyle) { var toolStrip = new SubToolStrip(); Assert.Null(toolStrip.CreateLayoutSettings(layoutStyle)); }
protected override LayoutSettings CreateLayoutSettings (ToolStripLayoutStyle style) { return base.CreateLayoutSettings (style); }
public LayoutSettings PublicCreateLayoutSettings (ToolStripLayoutStyle style) { return base.CreateLayoutSettings (style); }
public ToolStripDropDownMenu() : base() { this.layout_style = ToolStripLayoutStyle.Flow; this.show_image_margin = true; }