主题:中文成了方块"口"。请指教如何解决。
我在C#中有一段程序-读中文"txt"文件(如下),但在MessageBox和textBox中中文成了方块"口"。请指教如何解决(在button,lable和textBox属性中输入的中文显示都正常)。
private void button_readLGP_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
System.IO.StreamReader objFile = new System.IO.StreamReader(openFileDialog1.FileName);
string strTXT;
strTXT = objFile.ReadToEnd();
objFile.Close();
objFile.Dispose();
MessageBox.Show(strTXT);
textBox_LGP.Text = strTXT;
}
}
private void button_readLGP_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
System.IO.StreamReader objFile = new System.IO.StreamReader(openFileDialog1.FileName);
string strTXT;
strTXT = objFile.ReadToEnd();
objFile.Close();
objFile.Dispose();
MessageBox.Show(strTXT);
textBox_LGP.Text = strTXT;
}
}