我推荐了这个链接 1:如何在 asp.net 中使用 kannada 字体? 但我无法在我的页面中使用卡纳达语。我想在文本框中输入卡纳达语。 但它没有发生......谁能告诉我这可能是什么原因?
我的源代码在这里:forKannada.css 文件
@font-face {font-family:RaghuKannada;
src: url('http://www.cdacmumbai.in/projects/indix/RaghuFonts/RORaghuKannada.ttf');}
主页.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Home.aspx.cs" nherits="Home" Culture="kn-IN" UICulture="kn-IN" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//kn-IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="kn">
<head runat="server">
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../CSS/forKannada.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Kannada"Font-Names="Tunga" />
</form>
</body>
</html>
主页.aspx.cs 文件
public partial class Home : System.Web.UI.Page
{
ResourceManager rm;
CultureInfo ci;
static bool lkannda = false;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
rm = new ResourceManager("Resources.Strings",System.Reflection.Assembly.Load("App_GlobalResources")) ;
ci = Thread.CurrentThread.CurrentCulture;
LoadString(ci);
}
else
{
rm = new ResourceManager("Resources.Strings",System.Reflection.Assembly.Load("App_GlobalResources"));
ci =Thread.CurrentThread.CurrentCulture;
LoadString(ci);
}
}
private void LoadString(CultureInfo ci)
{
Label1.Text = rm.GetString("Name", ci);
Label2.Text = rm.GetString("Desc", ci);
Button1.Text = rm.GetString("AboutMe", ci);
}
protected void Button1_Click(object sender, EventArgs e)
{
if(lkannda)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
LoadString(Thread.CurrentThread.CurrentCulture);
lkannda = false;
}
else
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("kn-IN");
LoadString(Thread.CurrentThread.CurrentCulture);
lkannda = true;
}
}
}
我创建了 2 个资源文件,一个用于卡纳达语,另一个用于英语,名称为 Strings.kn-IN.resx 和 Strings.resx
谁能告诉我这段代码有什么错误。以及我如何在文本框中输入 kannada 作为图像显示?我还需要为此代码添加什么?