在win7环境下使用Devexpress中的SpinEdit控件,切换成中文【简/繁】输入法输入数字键时有不少输入法会重复产生数字
如输入1会变成11,输入123会变成112233。使用SpinEdit控件的解决办法是:可将SpinEdit控件的ImeMode属性设定为
Disable值,这样在控件获得焦点时将禁用输入法。页面上其他可输入中文的控件则将ImeMode属性设定为On。

但是当使用Devexpress中的GridControl进行编辑处理时会发现无论是GridControl,GridView还是GridColumns中的
ColumnEdit控件都没有ImeMode属性,这时候如何处理呢?可通设置GridView的ShownEditor事件或单独设定
ColumnEdit控件的Enter事件解决,一般情况下多列需要改变输入法状态用GridView的ShownEditor事件,单独一列
可使用ColumnEdit控件的Enter事件,代码如下:

TextBoxMaskBox GetInnerEdit(BaseEdit editor)
{
foreach (Control innerEditor in editor.Controls)
if (innerEditor is TextBoxMaskBox)
return innerEditor as TextBoxMaskBox;
return null;
} private void gridView1_ShownEditor(object sender, System.EventArgs e)
{
GridView view = sender as GridView;
if (view.FocusedColumn.FieldName == "FieldName")
{
TextBoxMaskBox innerEditor = GetInnerEdit(view.ActiveEditor);
if (innerEditor != null)
innerEditor.ImeMode = ImeMode.Katakana;
}
}

ColumnEdit控件的Enter事件:

private void SpinEdit1_Enter(object sender, System.EventArgs e)
{
TextBoxMaskBox innerEditor = GetInnerEdit(sender as TextEdit);
if (innerEditor != null)
innerEditor.ImeMode = ImeMode.Hiragana;
}

devexpress中gridview控件编辑时改变输入法状态的更多相关文章

  1. 玩转控件:重绘DEVEXPRESS中DateEdit控件 —— 让DateEdit支持只选择年月 (提供源码下载)

      前言 上一篇博文<玩转控件:重绘ComboBox —— 让ComboBox多列显示>中,根据大家的回馈,ComboBox已经支持筛选了,更新见博文最后最后最后面.   奇葩 这两天遇到 ...

  2. C#设置鼠标在控件上面时,改变光标形状

    //设置鼠标在控件上面时,改变光标形状 private void pictureBox_macroLogo_MouseHover(object sender, System.EventArgs e) ...

  3. Unity编辑器 - 鼠标悬停在控件上时改变鼠标样式

    Unity编辑器 - 鼠标悬停在控件上时改变鼠标样式 摘自Unity文档 EditorGUIUtility.AddCursorRect public static void AddCursorRect ...

  4. .NET中使用GridView控件输入数据时出现“ Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"的问题

    在.NET中使用GridView控件的在线编辑数据时,出现了“ Index was out of range. Must be non-negative and less than the size ...

  5. dev中gridview控件 z

    目录:一.客户端常用1.常用API2.聚焦行变更事件3.客户端选择多行4.客户端选择行5. 获取选择的行数目6.单击行时,选中行7.通过checkbox 选择行8.选择所有行9.启动编辑框,Conta ...

  6. ASP.NET中GridView控件删除数据的两种方法

      今天在用GridView控件时,发现了一个问题,就是使用GridView控件在删除数据时的问题.接下来我们通过模板列方式和CommandField方式删除某条数据讲解下两者之间的区别. 方式一:通 ...

  7. 关于开发C#中的asp.net中gridview控件的使用

    原文网址:http://blog.sina.com.cn/s/blog_67f1b4b201017663.html 1.GridView无代码分页排序: 效果图: 1.AllowSorting设为Tr ...

  8. Devexpress中WebChartControl控件柱状统计图的做法(数据为调用存储过程)

    //前台控件代码:WebChartControl控件: <%-- 月采购量统计--%> <dxchartsui:WebChartControl ID="WebChartCo ...

  9. DevExpress中 TreeList控件的常规配置

    //以下为TreeList控件样式相关设置 this.treelist_SystemCfg.BackColor = Color.Transparent; this.treelist_SystemCfg ...

随机推荐

  1. 10.MVC框架开发(Ajax应用)

    1.MVC自带的Ajax应用, 使用步骤: 第一步,引入js框架 <script src="../../Scripts/jquery-1.4.4.js" type=" ...

  2. data structure online video

    http://www.onlinevideolecture.com/computer-science/nptel-iit-delhi/data-structures-and-algorithms/?c ...

  3. POSIX多线程编程(上)-基本概念

    线程概念 我们把正在计算机中执行的程序叫做"进程"(Process) ,而不将其称为程序(Program).所谓"线程"(Thread),是"进程&q ...

  4. python中数据的保存

    1.将list中的数据写入到excel文件中 利用python包numpy(实现方式应该有许多种,这里只是记录成功实现的一种)中的savetxt 局限性:要保存的list可以为[1,2,3,4,5]这 ...

  5. GO语言函数与类型

    package main import () import ( "fmt" "reflect" "errors" ) type age in ...

  6. 理解sparse coding

    理解sparse coding 稀疏编码系列: (一)----Spatial Pyramid 小结 (二)----图像的稀疏表示——ScSPM和LLC的总结 (三)----理解sparse codin ...

  7. Adaboost原理及目标检测中的应用

    Adaboost原理及目标检测中的应用 whowhoha@outlook.com Adaboost原理 Adaboost(AdaptiveBoosting)是一种迭代算法,通过对训练集不断训练弱分类器 ...

  8. Vases and Flowers

    hdu4614:http://acm.hdu.edu.cn/showproblem.php?pid=4614 题意:给你n个花瓶,然后有两种操作:1从a开始选择b个花瓶,放进花,输出左端点,右端点 2 ...

  9. http://blog.sina.com.cn/s/blog_7caae74b0100zl17.html

    http://blog.sina.com.cn/s/blog_7caae74b0100zl17.html

  10. SQLite入门与分析(八)---存储模型(2)

    3.页面结构(page structure) 数据库文件分成固定大小的页面.SQLite通过B+tree模型来管理所有的页面.页面(page)分三种类型:要么是tree page,或者是overflo ...