ContextMenuStrip images don't update quickly, if you have controls with different RightToLeft settings

A customer complained that the ContextMenuStrip didn't render images correctly when assigned to more than one control, where, some controls were RightToLeft, while the other controls were not RightToLeft.

In this case, the context menu doesn't update its layout, so that it doesn’t render from RightToLeft to LeftToRight quickly.

The solution is to enforce the ContextStripMenu to perform the layout, each time it opens. Check this code:

private void Form1_Load(object sender, EventArgs e)

{

this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);

}

private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)

{

contextMenuStrip1.PerformLayout();

}

 

I hope this helps!