How to update a ToolStrip after programmatically adding a ToolStripButton


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Good to hear Smile
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
huh. Well, what I finally got to work was to move it slightly, the call refresh...



' Move it bit to left, then back to original place, then it redraws

me.myToolStrip.Location = New System.Drawing.Point(me.myToolStrip.Location.X +1,me.myToolStrip.Location.Y)

me.myToolStrip.Location = New System.Drawing.Point(me.myToolStrip.Location.X -1,me.myToolStrip.Location.Y)

me.myToolStrip.Refresh()

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You know... I'm not sure.  Calling Invalidate() will always cause the control to redraw itself.  However, in my test, it worked fine... the button was visible as soon as the form displayed.

Public Sub New()

' This call is required by the Windows Form Designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

Me.ThemedToolStrip1.Items.Add(New ToolStripMenuItem("Howdy"))

End Sub


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
In the constructor of a form, after the InitializeComponent, I add a ToolStripButton to a ToolStrip. When the form opens the new buttons isn't shown, until I manually move it. I've tried .Update, .Refresh, .Invalidate + .Refresh. I've tried these in the constructor, in form load, in form activate. Nada. How do you get a ToolStrip to repaint after changing the Items collection?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search