enc = System.Text.Encoding.GetEncoding("shift-jis")
datamodel = CType(FpSpread1.ActiveSheet.Models.Data, Model.DefaultSheetDataModel) Dim enc As System.Text.Encoding
Dim WithEvents datamodel As Model.DefaultSheetDataModel Private Sub datamodel_Changed(ByVal sender As Object, ByVal e As Model.SheetDataModelEventArgs) Handles datamodel.Changed
''非編集状態でクリップボードから貼り付けした場合
If e.Type = Model.SheetDataModelEventType.CellsUpdated Then
Try
If TypeOf (FpSpread1.Sheets().GetCellType(e.Row, e.Column)) Is CellType.TextCellType Then
Dim tCell As CellType.TextCellType = CType(FpSpread1.Sheets().GetCellType(e.Row, e.Column), CellType.TextCellType)
Dim s As String = CStr(datamodel.GetValue(e.Row, e.Column))
If enc.GetByteCount(s) > tCell.MaxLength Then
s = enc.GetString(enc.GetBytes(s), , tCell.MaxLength)
If enc.GetByteCount(s) > tCell.MaxLength Then
s = enc.GetString(enc.GetBytes(s), , tCell.MaxLength - )
Else
s = enc.GetString(enc.GetBytes(s), , tCell.MaxLength)
End If
datamodel.SetValue(e.Row, e.Column, s)
End If
End If
Catch
End Try
SwData =
End If
End Sub Private Sub FpSpread1_EditModeOn(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOn
If TypeOf (FpSpread1.ActiveSheet.GetCellType(iRow, iCol)) Is FarPoint.Win.Spread.CellType.CurrencyCellType _
Or TypeOf (FpSpread1.ActiveSheet.GetCellType(iRow, iCol)) Is FarPoint.Win.Spread.CellType.NumberCellType Then
FpSpread1.EditingControl.ImeMode = Windows.Forms.ImeMode.Off
ElseIf TypeOf (FpSpread1.ActiveSheet.GetCellType(iRow, iCol)) Is FarPoint.Win.Spread.CellType.TextCellType Then
FpSpread1.EditingControl.ImeMode = Windows.Forms.ImeMode.Hiragana
End If
End Sub Private Sub FpSpread1_EditChange(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.EditChange
' 編集中の入力制御
Try
' テキスト型セルの場合
If TypeOf e.View.GetSheetView.GetCellType(e.Row, e.Column) Is CellType.TextCellType Then
Dim tCell As CellType.TextCellType = CType(e.View.GetSheetView.GetCellType(e.Row, e.Column), CellType.TextCellType)
Dim s As String = e.EditingControl.Text
If enc.GetByteCount(s) > tCell.MaxLength Then
Dim chrs As Char() = enc.GetChars(enc.GetBytes(s), , tCell.MaxLength)
If Not Char.IsLetter(chrs(chrs.Length - )) Then
Array.Resize(chrs, chrs.Length - )
End If
e.EditingControl.Text = String.Concat(chrs)
CType(e.EditingControl, CellType.GeneralEditor).SelectionStart = e.EditingControl.Text.Length
End If
End If
Catch
End Try End Sub

SPREAD for Windows Forms 控制输入法的更多相关文章

  1. SPREAD for Windows Forms 代码片段

    'スクロールバーの移動 FpSpread1.ShowColumn(, , HorizontalPosition.Left) 'SetActiveCellの後.LeaveCellを呼び出す Dim ss ...

  2. SPREAD for Windows Forms 下箭头追加行

    ''' <summary> ''' 下矢印の動作クラス ''' </summary> ''' <remarks></remarks> Public Cl ...

  3. Wizard Framework:一个自己开发的基于Windows Forms的向导开发框架

    最近因项目需要,我自己设计开发了一个基于Windows Forms的向导开发框架,目前我已经将其开源,并发布了一个NuGet安装包.比较囧的一件事是,当我发布了NuGet安装包以后,发现原来已经有一个 ...

  4. Margin and Padding in Windows Forms Controls

    https://msdn.microsoft.com/en-us/library/ms229627.aspx Margin and Padding Precise placement of contr ...

  5. Windows Forms框架编程

    <Windows Forms框架编程>节选   第九章 设计模式与原则 软件设计模式(Design pattern)是一套被反复使用的代码设计经验总结.使用设计模式是为了可重用代码.让代码 ...

  6. System.Windows.Forms.Control : Component, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject....

    #region 程序集 System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...

  7. DotNetBar For Windows Forms 12.5.0.2 官方原版及注册

    转自原文DotNetBar For Windows Forms 12.5.0.2 官方原版及注册 DotNetBar是一款带有56个 Windows Form 控件的工具箱,使开发人员可以轻而易举地创 ...

  8. System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false

    多线程程序中,新创建的线程不能访问UI线程创建的窗口控件,这时如果想要访问窗口的控件,发现无法对其控制. 这时可将窗口构造函数中的CheckForIllegalCrossThreadCalls设置为f ...

  9. windows forms 上一个类似于wpf snoop 的工具: Hawkeye

    windows forms 上一个类似于wpf snoop 的工具: Hawkeye 周银辉 WPF上有snoop这样的run time object editor让人用着很爽, 今天搜到了一个for ...

随机推荐

  1. 通过shell脚本来rerun一个oozie调度失败的job,从而可以跳过执行失败的节点

    标题很长:通过shell脚本来rerun一个oozie调度失败的job,从而可以跳过执行失败的节点 不过目前从oozie调度测试的例子来看,oozie本身的retry好像并没有参数可以控制跳过失败的节 ...

  2. 微信扫码支付.net版本

    微信扫码支付有两个坑 1.模式一已经过时,不能使用了 2.HttpService类的POST 和 GET方法内的 //设置代理WebProxy proxy = new WebProxy();proxy ...

  3. BFS-广度优先遍历

    #include <iostream> #include <queue> using namespace std; /* 5 4 0 0 1 0 0 0 0 0 0 0 1 0 ...

  4. T-SQL 错误状态

    MS Windows Error Messages Code Error Message 0 操作成功完成. 1 功能错误. 2 系统找不到指定的文件. 3 系统找不到指定的路径. 4 系统无法打开文 ...

  5. Python 字典的操作

    #-*- coding:utf-8 -*- people = {"name":"jack","age":18,"addr" ...

  6. Windows 7 incorrectly reports "No Internet Access"

    PROBLEM DESCRIPTION Windows 7 may sometimes report that it has "No Internet Access"; this ...

  7. String和inputstream互转【转文】

    URLConnection urlConn = url.openConnection(); // 打开网站链接s BufferedReader reader = new BufferedReader( ...

  8. 原创:如何实现在Excel通过循环语句设置指定行的格式

    原创:如何实现在Excel通过循环语句设置指定行的格式 一.需求: 想让excel的某些行(比如3的倍数的行)字体变成5号字 如何整: 二.实现: Sub code() To Range(" ...

  9. android 8 wifi wifi 扫描过程

    查看一下android wifi扫描的过程. packages\apps\Settings\src\com\android\settings\wifi\WifiSettings.java public ...

  10. 第三百二十二节,web爬虫,requests请求

    第三百二十二节,web爬虫,requests请求 requests请求,就是用yhthon的requests模块模拟浏览器请求,返回html源码 模拟浏览器请求有两种,一种是不需要用户登录或者验证的请 ...