csharp:datagridview enter Half Width and Full Width characters
来源:互联网 发布:工程宝软件使用说明 编辑:程序博客网 时间:2024/05/29 15:43
/// <summary> /// 全角 /// </summary> /// <param name="unicodeString"></param> /// <returns></returns> public static string FullWidthConvertor(string unicodeString) { StringBuilder sb = new StringBuilder(256); LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_FULLWIDTH, unicodeString, -1, sb, sb.Capacity); return sb.ToString(); } /// <summary> /// 半角 /// </summary> /// <param name="unicodeString"></param> /// <returns></returns> public static string HalfWidthConvertor(string unicodeString) { StringBuilder sb = new StringBuilder(256); LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_HALFWIDTH, unicodeString, -1, sb, sb.Capacity); return sb.ToString(); } private const uint LCMAP_FULLWIDTH = 0x00800000; private const uint LOCALE_SYSTEM_DEFAULT = 0x0800; private const uint LCMAP_HALFWIDTH = 0x00400000; [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] public static extern int LCMapString(uint Locale, uint dwMapFlags, string lpSrcStr, int cchSrc, StringBuilder lpDestStr, int cchDest); /// <summary> /// DataGridView单位格输入全角转半角 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dridViewRowNumberNo_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { GridViewRowNumberNo dt = sender as GridViewRowNumberNo; //获取列序号 int columnIndex = dt.CurrentCell.ColumnIndex; //单位格转化成文本框 TextBox tb = e.Control as TextBox; //委托单位格KeyPress事务 tb.KeyPress += new KeyPressEventHandler(geovindu_KeyPress); } /// <summary> /// 单位格KeyPress事务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void geovindu_KeyPress(object sender, KeyPressEventArgs e) { Control ctl = sender as Control; if (ctl == null) return; if (ctl.ImeMode != ImeMode.Hangul) ctl.ImeMode = ImeMode.Hangul; //全角转半角 if (e.KeyChar >= 65296 && e.KeyChar <= 65305) { e.KeyChar -= Convert.ToChar(65248); } }
0 0
- csharp:datagridview enter Half Width and Full Width characters
- csharp:datagridview enter Half Width and Full Width characters
- Full width at half maximum
- width
- width
- width
- 【matlab】Peak SideLobe Ratio And Half Angle Width峰值旁瓣比和半功率角宽
- width和max-width
- manipulator and setiosflags and limit width
- Tab插件之 Responsive Full Width Tabs 的使用
- Set Height and Width Pie Chart
- absolutely positioned element and percentage width
- IE8 BUG WITH MAX-WIDTH AND OVERFLOW
- width and horizontal position are ambiguous
- studyjams notes 1B--width and height
- 得到屏幕的Width And Height
- width and hgiht must be > 0
- web-屏幕、浏览器、页面-width and height
- 数据库Oracle DB2 MySQL 分页
- 树莓派与Arduino的串口通信
- editext文本输入框 软键盘下个按钮的问题
- a 标签中调用js的几种方法
- csharp:datagridview enter Half Width and Full Width characters
- csharp:datagridview enter Half Width and Full Width characters
- Dijkstra总结
- jpa 对 h2数据库的配置
- 好久没看书了,DIV+CSS,我又来了
- android JNI编译注意事项
- Windows 7+VirtualBox安装Mac OS X虚拟机全教程
- Android中Application使用,保存应用程序全局变量
- VC实现随内容改变高度的Edit Control
- VirtualAlloc, HeapAlloc, malloc和new