eMbedded Visual C++ 4.0eVC.NET CFWindows MobileVisual C++ 8.0ArchitectAdvancedC# 2.0C# 3.0IntermediateDevC++C#
智能设备的阿拉伯化控件






3.86/5 (9投票s)
用于开发智能设备阿拉伯化应用程序的 .NET 控件。
引言
启用阿拉伯化的 Compact .NET Framework 程序集允许 .NET 开发者在不使用任何其他外部软件的情况下创建阿拉伯化应用程序。
背景
这个想法源于我在 Symbol 手持设备上开发 Windows CE 5.0 的货架价格检查器和标签打印软件时。我需要检索、显示和打印阿拉伯语(印地语)数字和文本。
Using the Code
这段代码是设计时控件的示例代码。
这个项目已经完成,但可能需要根据您的需求进行一些修改。
/* Sample code for Arabic Button */
using System.Drawing;
using System.Windows.Forms;
using System.Text;
namespace Ar.Controls
{
public class ArabicButton : System.Windows.Forms.Button
{
private bool m_HindiNumerals;
private string m_LogicalText;
private bool m_RightToLeft;
public bool HindiNumerals
{
get
{
return this.m_HindiNumerals;
}
set
{
this.m_HindiNumerals = value;
this.Text = this.m_LogicalText;
}
}
public new bool RightToLeft
{
get
{
return this.m_RightToLeft;
}
set
{
this.m_RightToLeft = value;
this.Text = this.m_LogicalText;
}
}
public new string Text
{
get
{
return this.m_LogicalText;
}
set
{
if (value != null)
{
this.m_LogicalText = value;
StringBuilder builder1 =
new StringBuilder(this.Text.Length + 1);
short num1 = (short) this.m_LogicalText.Length;
ushort[] numArray1 = new ushort[1];
if (this.m_HindiNumerals)
{
numArray1[0] = 1;
}
else
{
numArray1[0] = 0;
}
mArabicCoreWrapper.BuildArabicStringWithLigate
(this.m_RightToLeft, this.Text, builder1, num1, numArray1);
base.Text = builder1.ToString();
}
}
}
public override System.Drawing.Font Font
{
get
{
return base.Font;
}
set
{
base.Font = value;
Invalidate();
}
}
public ArabicButton()
{
//this.Font = new Font("Tahoma", 8f, FontStyle.Regular);
this.m_RightToLeft = true;
this.m_HindiNumerals = true;
}
} // class ArabicButton
}
它适用于 compact framework 版本 2.0,并在 Windows CE 5.0 和 Windows Mobile 5.0 上进行了测试。
关注点
阿拉伯语是一种非常复杂和美丽的语言。我希望在编程中使用这种语言,而不是英语。
历史
这个项目始于 2005 年初,肯定需要一些修改。
- 2009年11月5日:在文章附件中添加了 mArabicCore