てことで、昨日の記事で書いた Microsoft International Packをちょっと使ってみました。
サンプルを以下の場所にあげておきましたのでそれを触ってもらった方がイメージが掴みやすいと
思います。(要 VisualStudio2008)
- InternationalPackSamples
以下のような画面となっています。(ヘボいサンプルですが・・m(_ _)m)

後は適当に触ってみてください。
一応、ソースコード。
[Form1.cs]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Forms;
using Microsoft.International.Converters;
using Microsoft.International.Formatters;
namespace Gsf.Samples {
public partial class Form1 : Form {
private IFormatProvider _formatProvider;
public Form1() {
InitializeComponent();
_formatProvider = new EastAsiaNumericFormatter();
}
private void Form1_Load(object sender, EventArgs e) {
//
// Kana Converterの検証用のイベント設定.
//
new List { txt1, txt2, txt3, txt4, txt5, txt6, txt7 }.ForEach*1{
return;
}
int controlValue;
if (!int.TryParse(controlText, out controlValue)) {
MessageBox.Show(this, "数値を指定してください。");
e.Cancel = true;
return;
}
string controlName = control.Name;
string format = control.Tag.ToString();
Control resultControl = grpEastAsiaNumericFormatters.Controls.Find(string.Format("{0}Result", controlName), false)[0];
resultControl.Text = String.Format(_formatProvider, format, controlValue);
}
}
}
[YomiAutoTextBox.cs]
using System;
using System.Windows.Forms;
using Microsoft.International.Windows;
namespace Gsf.Samples {
///
/// YomiAutoCompletionListenerを内部に保持することで読みの自動補完に対応している
/// カスタムテキストボックスです。
///
internal class YomiAutoTextBox : TextBox{
private YomiAutoCompletionListener _listener;
public YomiAutoTextBox() {
_listener = new YomiAutoCompletionListener(this);
}
public YomiAutoCompletionContextManager ContextManager{
get{
if(_listener == null){
return null;
}
return _listener.ContextManager;
}
}
}
}
*1:control) => {
control.Validated += KanaConverterControls_Validated;
});
//
// East Asia Numeric Formatterの検証用のイベント設定.
//
new List