How to make ToolStrip ComboBox resize when the dialog is resized?

Hey!

How can I make the ToolSripComboBox automatically resize when the dialog is resized?

Matt

[98 byte] By [MateuszRajca] at [2007-12-22]
# 1

you can handle form's resize event and calculate toolstripCombo Width manualy

this is what I could do

hope this helps

GalinIliev at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
What code do I add to the resize event?

Matt

MateuszRajca at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 3
HELP!
MateuszRajca at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 4
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
Dim w As Integer = ToolStrip1.Width
ToolStripComboBox1.Width = WhatEverStillFitsAndIsAcceptableToTheUser(w)
End Sub

nobugz at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 5
C# please.
MateuszRajca at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 6
private void Form1_Resize(object sender, EventArgs e)

{

int w = toolStrip1.Width;

toolStripComboBox1.Width = WhatEverStillFitsAndIsAcceptableToUser(w);

}

nobugz at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 7
what do you mean by: WhatEverStillFitsAndIsAcceptableToUser(w); ?

Matt

MateuszRajca at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 8
That's

your function to write to determine how to fit the toolstrip controls

into the available toolstrip width. I'd do something like

multiply the original design widths of the resizeable controls by a

percentage, clipping to a low value below which the control becomes

unusable...

nobugz at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...