InputKeyboard 1.0.7
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Framework 4.5.2
This package targets .NET Framework 4.5.2. The package is compatible with this framework or higher.
dotnet add package InputKeyboard --version 1.0.7
NuGet\Install-Package InputKeyboard -Version 1.0.7
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="InputKeyboard" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="InputKeyboard" Version="1.0.7" />
<PackageReference Include="InputKeyboard" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add InputKeyboard --version 1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: InputKeyboard, 1.0.7"
#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.
#:package InputKeyboard@1.0.7
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=InputKeyboard&version=1.0.7
#tool nuget:?package=InputKeyboard&version=1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
InputKeyboard ⌨️
一个基于 WPF 开发的 Windows 虚拟软键盘程序,支持多种键盘布局、多点触控、无焦点窗口等特性,适用于触摸屏设备、嵌入式系统和定制化输入场景。
🔗 Gitee 镜像
💰 支持项目
如果这个项目对你有帮助,欢迎扫描下方二维码支持开发者。
📧 联系与定制
如需定制开发或商业合作,请联系:Lvwl@outlook.com
✨ 功能特性
- 多种键盘布局:提供普通全键盘、纯字符、字符+数字、数字小键盘、数字+运算符号等多种布局
- 多点触控支持:兼容触摸屏设备,支持组合键(Ctrl/Shift/Alt/Win)同时按下
- 无焦点窗口:点击键盘按钮时不会夺走目标窗口的焦点,不影响前台应用操作
- 窗口高度可定制:支持自定义窗口标题、位置、透明度、缩放比例
- 多框架兼容:同时支持 .NET Framework 4.5.2 / 4.6.2 / 4.8 和 .NET 6 / 8 / 10
- CapsLock / NumLock 状态同步:自动检测并同步系统键盘锁定状态
- 输入法语言切换:内置语言切换按钮,模拟 Alt+Shift 切换前台应用输入法
- 多种启动方式:支持直接运行、命令行参数启动、.NET 工程引用集成调用
📸 键盘布局预览
| 普通布局 | 字符布局 | 字符+数字布局 |
|---|---|---|
| 数字小键盘 | 数字+符号 |
|---|---|
🚀 使用方法
方法一:直接运行
双击 InputKeyboard.exe 即可打开默认布局的软键盘。
方法二:命令行启动(带参数)
通过命令行传递参数自定义键盘外观和行为:
InputKeyboard.exe Layout=Number MultiTouch=True Title=测试 Left=300 Top=300 Opacity=0.9 SizePercent=1.2
或通过 Windows 运行 对话框(Win+R):
"{程序根目录}\InputKeyboard.exe" Layout=Normal MultiTouch=False
方法三:.NET 工程集成
在你的 .NET 桌面项目中引用 InputKeyboard.exe,通过代码控制键盘显示:
// 引入命名空间
using InputKeyboard;
// 创建参数并显示键盘
var param = new WindowShowParam
{
Layout = "Number", // 键盘布局
MultiTouch = true, // 多点触控模式
Title = "输入键盘", // 窗口标题
Left = 300, // 窗口左侧距离
Top = 300, // 窗口顶部距离
Opacity = 0.9, // 窗口透明度
SizePercent = 1.0 // 窗口缩放比例
};
App.ShowKeyboardWindow(param);
⚙️ 启动参数说明
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Layout |
string | 否 | Normal |
键盘布局类型,详见下方布局列表 |
MultiTouch |
bool | 否 | False |
是否启用多点触控模式(True / False 或 1 / 0) |
Title |
string | 否 | 空 | 窗口标题,为空时不显示标题栏内容 |
Left |
double | 否 | 自动计算 | 窗口距离屏幕左侧的像素距离 |
Top |
double | 否 | 自动计算 | 窗口距离屏幕顶部的像素距离 |
Opacity |
double | 否 | 1.0 |
窗口不透明度,取值范围 0.0 ~ 1.0 |
SizePercent |
double | 否 | 1.0 |
窗口整体缩放比例,如 1.5 表示放大 1.5 倍 |
💡 提示:当
Left或Top未设置时,程序会自动根据鼠标当前所在位置计算出合适的显示位置。
键盘布局(Layout)
| 值 | 对应类 | 说明 |
|---|---|---|
Normal |
View.Normal |
标准全键盘布局(默认) |
Letters |
View.Letters |
纯字符键布局 |
LettersNumber |
View.LettersAndNumber |
字符 + 数字组合布局 |
LettersNumberNoFunctionKeys |
View.LettersAndNumberNoFunctionKeys |
字符 + 数字(无功能键) |
Number |
View.Number |
数字小键盘布局 |
NumberSymbol |
View.NumberAndSymbol |
数字小键盘 + 运算符号 |
多点触控模式(MultiTouch)
| 值 | 说明 |
|---|---|
False |
非多点触控模式(默认),修饰键(Shift/Ctrl/Alt/Win)为切换锁定模式 |
True |
多点触控模式,修饰键需要同时按下才能触发组合键效果 |
🧱 项目结构
src/
├── InputKeyboard/ # 主项目
│ ├── Control/
│ │ └── ControlProperty.cs # 自定义附加属性(图标、圆角、密码框等)
│ ├── Converter/
│ │ └── CapitalCharConverter.cs # 大小写转换器
│ ├── Theme/
│ │ └── Window.xaml # 窗口主题样式
│ ├── View/
│ │ ├── BaseWindow.cs # 窗口基类(事件注册、窗口定位、无焦点设置)
│ │ ├── Normal.xaml/.cs # 普通全键盘布局
│ │ ├── Letters.xaml/.cs # 纯字符布局
│ │ ├── LettersAndNumber.xaml/.cs # 字符+数字布局
│ │ ├── LettersAndNumberNoFunctionKeys.xaml/.cs # 字符+数字(无功能键)
│ │ ├── Number.xaml/.cs # 数字小键盘布局
│ │ └── NumberAndSymbol.xaml/.cs # 数字+符号布局
│ ├── ViewModel/
│ │ └── BaseWindowViewModel.cs # 视图模型(按键逻辑、输入法管理)
│ ├── App.xaml/.cs # 应用程序入口(参数解析、窗口创建)
│ ├── User32.cs # Win32 API 封装(键盘事件、窗口操作)
│ └── InputKeyboard.csproj # 项目文件(多目标框架)
└── Test/ # 测试项目
└── ...
技术架构
┌─────────────────────────────────────┐
│ App.xaml.cs │
│ 参数解析 → 窗口创建 → 进程管理 │
└──────────────┬──────────────────────┘
│ 创建
┌──────────────▼──────────────────────┐
│ View (XAML + Code-behind) │
│ Normal / Letters / Number / ... │
│ 继承自 BaseWindow │
└──────────────┬──────────────────────┘
│ DataContext
┌──────────────▼──────────────────────┐
│ ViewModel │
│ BaseWindowViewModel │
│ 按键处理 / 状态管理 / 输入法切换 │
└──────────────┬──────────────────────┘
│ 调用
┌──────────────▼──────────────────────┐
│ User32.cs │
│ Win32 API (keybd_event, ...) │
│ 底层键盘事件模拟 │
└─────────────────────────────────────┘
🔧 构建
环境要求
- .NET SDK(支持 .NET 6 / 8 / 10)
- 如需编译 .NET Framework 目标,还需安装对应的 .NET Framework 开发者包
- Windows 操作系统
编译命令
# 进入项目目录
cd src\InputKeyboard
# 编译所有目标框架
dotnet build
# 编译特定框架(示例:net8.0-windows)
dotnet build -f net8.0-windows
编译产物位于 src\InputKeyboard\bin\{Configuration}\{TargetFramework}\ 目录下。
📝 版本记录
V1.0.6
- 当前最新版本
V1.0.2
- 添加键盘扫描码(Scan Code),提升应用程序兼容性
V1.0.1
- 新增窗口不透明度(Opacity)参数
V1.0.0
- 🎉 首次发布,包含基础软键盘功能
📄 开源协议
本项目基于 MIT License 开源,可自由使用、修改和分发。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
| .NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
net10.0-windows7.0
- No dependencies.
-
net6.0-windows7.0
- No dependencies.
-
net8.0-windows7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.7 | 135 | 7/8/2026 |