Sinu  Joseph

Sinu Joseph

  • NA
  • 136
  • 65.4k

Changing System Locale dynamically in Windows forms

Oct 7 2015 3:14 AM
Hi All,
 
Thanks in advance ..
 
i just want to change the system locale at runtime
 
My purpose is this :
> i have added axmediaplayer and have subtitle in .smi format in english also working correctly
 > i need to switch the subtitle while running , i have converted the .smi file with thai language but its doesnt shows the thai language ,instead of thai its shows some unformat .
> if i changed the system locale to thai from control panel >  clock,languand and region > administrative >( change language for non unicode programs) here i have changed the language to thai its works .
>can u help me to do it dynamically
 
private void panelthaisubtitle_Click(object sender, EventArgs e)
{
_subtitleCode = "3"; //Thai
 
this.panelAnotherNew.BackgroundImage = global::UOB_Project.Properties.Resources.another_active;
this.panelEnglishNew.BackgroundImage = global::UOB_Project.Properties.Resources.english;
this.panelChinaNew.BackgroundImage = global::UOB_Project.Properties.Resources.China_Dis;
this.panelBahasaNew.BackgroundImage = global::UOB_Project.Properties.Resources.Bahasa_Dis;
}
 
 
 
   DataTable mydt = new DataTable();
   //string sub = "select distinct Subtitles from Module_Subtitles where Subtitles not null and Module_ModuleID=" + ModulemastID;
   string sub = string.Empty;
   //english language
   if (_subtitleCode == "1")
   sub = "select distinct Subtitles from Module_Subtitles where Subtitles not null and LanguageOrder=1 and Module_ModuleID=" + ModulemastID;
     //thai language 
    else if (_subtitleCode == "2")
   sub = "select distinct Subtitles from Module_Subtitles where Subtitles not null and LanguageOrder=2 and Module_ModuleID=" + ModulemastID;
   else if (_subtitleCode == "3")
   sub = "select distinct Subtitles from Module_Subtitles where Subtitles not null and LanguageOrder=3 and Module_ModuleID=" + ModulemastID;
   else if (_subtitleCode == "4")
   sub = "select distinct Subtitles from Module_Subtitles where Subtitles not null and LanguageOrder=4 and Module_ModuleID=" + ModulemastID;
   SQLiteCommand command1 = new SQLiteCommand();
   command1 = connection.CreateCommand();
   command1.CommandText = sub;
   SQLiteDataAdapter da1 = new SQLiteDataAdapter(command1);
   da1.Fill(mydt);
   if (mydt.Rows.Count > 0)
   {
   axWindowsMediaPlayer1.closedCaption.SAMIFileName = NewpathLoc + mydt.Rows[0].ItemArray[0].ToString();
   }
   else
   {
   axWindowsMediaPlayer1.closedCaption.SAMIFileName = "";
   }
   axWindowsMediaPlayer1.Ctlcontrols.stop();
 
 
 

Answers (2)