ImeSharp 1.4.0

dotnet add package ImeSharp --version 1.4.0                
NuGet\Install-Package ImeSharp -Version 1.4.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ImeSharp" Version="1.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImeSharp --version 1.4.0                
#r "nuget: ImeSharp, 1.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ImeSharp as a Cake Addin
#addin nuget:?package=ImeSharp&version=1.4.0

// Install ImeSharp as a Cake Tool
#tool nuget:?package=ImeSharp&version=1.4.0                

IME Sharp

Nuget

A C# wrapper for Windows IME APIs. Its goal is to support both IMM32 and TSF.

TSF Implementation is based on WPF core.

Packages

dotnet add package ImeSharp

Note ImeSharp.NetStandard package is deprecated, use ImeSharp instead.

Usage

Initialization

Call InputMethod.Initialize to initialize the input method with a window handle, e.g. InputMethod.Initialize(someWindowHandle).

If you don't want the OS Candidate Window, do InputMethod.Initialize(someWindowHandle, false).

Custom message pumping

If we don't enable custom windows message pumping. Use TSF in WinForms would have a issue: Frame will randomly stuck when composing with IME. This is because TSF disables Application.Idle event when it's busy. Enables custom message pumping fix this.

In WinForms, we add message pumping at the end line in Application.Idle handler, e.g.:

private void Application_Idle(object sender, EventArgs e)
{
    Game.Tick();

    // Enables custom message pumping
    InputMethod.PumpMessage();
}

Hook events

InputMethod.TextInputCallback = OnTextInput;
InputMethod.TextCompositionCallback = OnTextComposition;

Retrieve other composition info from InputMethod.CandidateList and other fields for CJK IMEs.

Set position of OS rendered IME Candidate Window

InputMethod.SetTextInputRect(location.X, location.Y, 0, textBoxHeight);

Test IMM32 implementation only

IMM32 would be only enabled if TSF service is not available. You can return false manually in TextServicesLoader.ServicesInstalled to mimic TSF unavailable case.

TODO

  • Make it work in Unity3d

MS Docs

Other samples / implementations

Credits

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ImeSharp:

Package Downloads
FNA.NET

Fork of FNA with nuget packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.0 333 3/13/2024
1.2.5 3,316 6/15/2021
1.2.5-preview3 273 9/9/2020
1.2.4 462 8/29/2020
1.2.3 424 8/26/2020
1.2.2 430 8/24/2020
1.2.1 420 8/21/2020
1.2.0 403 8/21/2020
1.1.0 468 8/20/2020
1.0.0 436 8/19/2020