LVGLSharp.Native
9.0.3.2
See the version list below for details.
dotnet add package LVGLSharp.Native --version 9.0.3.2
NuGet\Install-Package LVGLSharp.Native -Version 9.0.3.2
<PackageReference Include="LVGLSharp.Native" Version="9.0.3.2" />
<PackageVersion Include="LVGLSharp.Native" Version="9.0.3.2" />
<PackageReference Include="LVGLSharp.Native" />
paket add LVGLSharp.Native --version 9.0.3.2
#r "nuget: LVGLSharp.Native, 9.0.3.2"
#:package LVGLSharp.Native@9.0.3.2
#addin nuget:?package=LVGLSharp.Native&version=9.0.3.2
#tool nuget:?package=LVGLSharp.Native&version=9.0.3.2
LVGLSharp.Forms
中文 | English
LVGLSharp.Forms 是一个跨平台的 WinForms API 兼容层,以 LVGL 作为底层渲染引擎。目标是实现所见即所得——在 Visual Studio Windows Forms 设计器中设计的界面,可以在 Linux(arm / arm64 / x64)等嵌入式平台上以高度一致的效果运行。
⚠️ 项目目前处于试验阶段,尚不可用于生产环境。
✨ 特性
- 🖥️ WinForms API 兼容:使用与
System.Windows.Forms高度相似的 API,轻松迁移现有代码。 - 🔤 LVGL 全 API 互操作:基于 ClangSharpPInvokeGenerator 自动生成的 P/Invoke 绑定,覆盖 LVGL 全部 C API。
- 🚀 NativeAOT 支持:支持发布为无依赖的原生可执行文件(已验证 win-x64 / linux-arm)。
- 🌍 跨平台:支持 Windows(x86 / x64 / arm64)、Linux(x64 / arm / arm64)。
- 🧩 内置常用控件:Button、Label、TextBox、CheckBox、RadioButton、ComboBox、ListBox、ProgressBar、TrackBar、NumericUpDown、PictureBox、Panel、GroupBox、FlowLayoutPanel、TableLayoutPanel、RichTextBox 等。
- 🎨 自定义绘图类型:提供
LVGLSharp.Darwing命名空间下的Size、Point、Color等类型,无需依赖System.Drawing,天然跨平台。
📷 预览
以下为经过 NativeAOT 发布的 win-x64 / linux-arm 应用程序预览(无任何额外依赖):
<iframe src="//player.bilibili.com/player.html?isOutside=true&aid=116237182962589&bvid=BV12Fwjz5EuZ&cid=36733586714&p=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
📦 NuGet 包
| 包名 | 说明 |
|---|---|
LVGLSharp.Forms |
WinForms API 兼容层(核心包) |
LVGLSharp.Interop |
LVGL P/Invoke 绑定(自动生成) |
LVGLSharp.Native |
各平台 LVGL 原生库(win-x86 / win-x64 / win-arm64、linux-arm 等) |
🚀 快速开始
1. 创建项目
推荐按仓库中的示例采用多目标框架的方式:使用 Visual Studio 创建 Windows Forms 应用程序(.NET),以 net10.0-windows 目标启用设计器(UseWindowsForms=true),再增加一个纯 net10.0 目标用于跨平台运行并在该目标下引用 LVGLSharp.Forms。可参考示例工程的配置:src/Demos/WinFormsDemo/WinFormsDemo.csproj。
2. 入口程序
using LVGLSharp.Forms;
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
3. 在 Linux 上运行
使用 NativeAOT 发布:
dotnet publish -r linux-arm64 -c Release
🏗️ 项目结构
src/
├── LVGLSharp.WinForms/ # WinForms API 兼容层(核心)
│ ├── Forms/ # 控件实现(Control、Form、Button 等)
│ ├── Darwing/ # 跨平台绘图类型(Size、Point、Color 等)
│ └── Runtime/ # 平台运行时(Windows / Linux)
├── LVGLSharp.Interop/ # LVGL P/Invoke 自动生成绑定
├── LVGLSharp.Native/ # 各平台原生库
├── LVGLSharp.Core/ # 公共核心库
└── Demos/
└── WinFormsDemo/ # 演示项目
libs/
└── lvgl/ # LVGL 源码(submodule)
🙏 致谢
- imxcstar / LVGLSharp:提供了最底层的 LVGL .NET 封装支撑,本项目基于此构建。
- LVGL:轻量级、高性能的嵌入式 GUI 库。
- ClangSharpPInvokeGenerator:用于自动生成 LVGL 全量 P/Invoke 绑定。
- SixLabors.ImageSharp:跨平台图像处理库。
- SixLabors.Fonts:跨平台字体解析库。
💬 交流
欢迎加入微信群,与我们交流项目使用、跨平台适配、控件实现与问题排查经验。
如果你对 LVGLSharp.Forms 感兴趣,欢迎扫码加入微信群交流。
📄 许可证
本项目基于 MIT License 开源。
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LVGLSharp.Native:
| Package | Downloads |
|---|---|
|
LVGLSharp.Interop
Auto-generated low-level P/Invoke bindings for LVGL, generated through ClangSharpPInvokeGenerator and intended for advanced integrations, custom hosts, and full C API access from .NET. |
GitHub repositories
This package is not used by any popular GitHub repositories.