I got a question from a customer in pain over the unwanted flickering of his application when he switches between English and Arabic.
His scenario is simple; he has a multilingual application and wants to switch the UI between English and Arabic at runtime. The logic is that he would change his UI Culture , load the resources and set RightToLeft=Yes. Check the below code:
My.Application.ChangeUICulture("ar-EG ") ' Load the en-US for the English(US) resources
Dim l_crm As ComponentResourceManager
l_crm = New ComponentResourceManager(GetType(mdi))
' Load the correct resources
If Thread.CurrentThread.CurrentUICulture.ToString = "ar-EG" Then
Me.RightToLeft = Windows.Forms.RightToLeft.Yes
Me.RightToLeft = Windows.Forms.RightToLeft.No
The result is the Form would flicker while it changes RightToLeft.
First, let's discuss why this happens:
Basically, when you set RightToLeft at runtime, VS saves the Window state and recreates the Window and add RightToLeft styles to it.
There is no way to overcome this flickering.
However, my recommendation is not to follow your above localization method because it has two drawbacks:
1) You need to manually load the resources on language change.
2) The screen flickers when you switch the application to right-to-left (rtl)
The recommended method is to change the UI culture of the application when the user restarts the application and not in the middle of his application.
This means set an Application Setting called UICulture and when you open the application set your apps UICulture and there is no need to load the resources since it would be handled automatically.I hope this helps