syncfusion-winforms-fontlistbox
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing the Syncfusion WinForms FontListBox Control
实现Syncfusion WinForms FontListBox控件
The Syncfusion () is a -derived control that automatically populates itself with all fonts installed on the user's system. It supports multiple selection modes, type-to-match auto-complete, horizontal scrollbars, item height control, and Office-style visual themes.
FontListBoxSyncfusion.Windows.Forms.Tools.FontListBoxListBoxSyncfusion ()是派生自的控件,可自动使用用户系统上安装的所有字体完成自身内容填充。它支持多种选择模式、输入匹配自动补全、水平滚动条、条目高度控制以及Office风格的视觉主题。
FontListBoxSyncfusion.Windows.Forms.Tools.FontListBoxListBoxWhen to Use This Skill
何时使用本指南
Use this skill when you need to:
- Display a list of installed system fonts — auto-populated on creation
- Allow users to select a font — apply the selected font to labels, text boxes, or other controls
- Configure selection modes — single, multi-simple, or multi-extended selection
- Enable type-to-match auto-complete —
UseAutoComplete - Apply Office visual styles — with
VisualStyleenumFontListBoxStyle - Control scrollbar visibility — ,
HorizontalScrollbarScrollAlwaysVisible - Handle font selection events —
SelectedIndexChanged
当你需要实现以下需求时可使用本指南:
- 展示已安装系统字体列表 —— 控件创建时自动填充内容
- 允许用户选择字体 —— 将选中的字体应用到标签、文本框或其他控件
- 配置选择模式 —— 单选、简单多选或扩展多选
- 启用输入匹配自动补全 ——
UseAutoComplete - 应用Office视觉样式 —— 搭配枚举使用的
FontListBoxStyle属性VisualStyle - 控制滚动条可见性 —— 、
HorizontalScrollbarScrollAlwaysVisible - 处理字体选择事件 ——
SelectedIndexChanged
Component Overview
组件概览
| Property | Type | Description |
|---|---|---|
| | One, MultiSimple, or MultiExtended |
| | Type-ahead matching within the list |
| | Sort font names alphabetically |
| | Height in pixels of each list item |
| | Show horizontal scrollbar when items overflow |
| | Width (px) of the scrollable area when horizontal scrollbar is on |
| | Keep scrollbars visible regardless of item count |
| | Office/Metro visual theme |
| 属性 | 类型 | 描述 |
|---|---|---|
| | 可选值:One、MultiSimple、MultiExtended |
| | 列表内的输入预匹配功能 |
| | 按字母顺序排序字体名称 |
| | 每个列表条目的高度,单位为像素 |
| | 当条目溢出时显示水平滚动条 |
| | 启用水平滚动条时可滚动区域的宽度(像素) |
| | 无论条目数量多少,始终保持滚动条可见 |
| | Office/Metro视觉主题 |
Documentation and Navigation Guide
文档与导航指南
Getting Started
入门指南
📄 Read: references/getting-started.md
- Assembly references and NuGet package setup
- Adding FontListBox via designer or programmatically
- Auto-population with system fonts
- SelectionMode — None, One, MultiSimple, MultiExtended
- Handling SelectedIndexChanged to apply font to another control
📄 阅读: references/getting-started.md
- 程序集引用与NuGet包设置
- 通过设计器或代码方式添加FontListBox
- 系统字体自动填充
- SelectionMode可选值:None、One、MultiSimple、MultiExtended
- 处理SelectedIndexChanged事件将选中字体应用到其他控件
Customization and Behavior
自定义与行为配置
📄 Read: references/customization-and-behavior.md
- — row height per font entry
ItemHeight - — alphabetical sorting of font names
Sorted - — type-to-match as user types
UseAutoComplete - +
HorizontalScrollbarHorizontalExtent - — force scrollbars always visible
ScrollAlwaysVisible
📄 阅读: references/customization-and-behavior.md
- —— 每个字体条目的行高
ItemHeight - —— 字体名称按字母排序
Sorted - —— 用户输入时自动匹配对应条目
UseAutoComplete - +
HorizontalScrollbarHorizontalExtent - —— 强制滚动条始终可见
ScrollAlwaysVisible
Visual Styles
视觉样式
📄 Read: references/visual-styles.md
- property using
VisualStyleenumFontListBoxStyle - Available styles: Default, Metro, Office2016Colorful, Office2016White, Office2016Black, Office2016DarkGray
📄 阅读: references/visual-styles.md
- 搭配枚举使用的
FontListBoxStyle属性VisualStyle - 可用样式:Default、Metro、Office2016Colorful、Office2016White、Office2016Black、Office2016DarkGray
Quick Start
快速开始
C#:
csharp
using Syncfusion.Windows.Forms.Tools;
FontListBox fontListBox1 = new FontListBox();
fontListBox1.Size = new System.Drawing.Size(160, 94);
fontListBox1.UseAutoComplete = true;
fontListBox1.SelectionMode = System.Windows.Forms.SelectionMode.One;
fontListBox1.SelectedIndexChanged += FontListBox1_SelectedIndexChanged;
this.Controls.Add(fontListBox1);
private void FontListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label1.Font = new System.Drawing.Font(
fontListBox1.SelectedItem.ToString(), 11, System.Drawing.FontStyle.Regular);
}VB.NET:
vb
Imports Syncfusion.Windows.Forms.Tools
Dim fontListBox1 As New FontListBox()
fontListBox1.Size = New System.Drawing.Size(160, 94)
fontListBox1.UseAutoComplete = True
fontListBox1.SelectionMode = System.Windows.Forms.SelectionMode.One
AddHandler fontListBox1.SelectedIndexChanged, AddressOf FontListBox1_SelectedIndexChanged
Me.Controls.Add(fontListBox1)
Private Sub FontListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
label1.Font = New System.Drawing.Font(
fontListBox1.SelectedItem.ToString(), 11, System.Drawing.FontStyle.Regular)
End SubC#:
csharp
using Syncfusion.Windows.Forms.Tools;
FontListBox fontListBox1 = new FontListBox();
fontListBox1.Size = new System.Drawing.Size(160, 94);
fontListBox1.UseAutoComplete = true;
fontListBox1.SelectionMode = System.Windows.Forms.SelectionMode.One;
fontListBox1.SelectedIndexChanged += FontListBox1_SelectedIndexChanged;
this.Controls.Add(fontListBox1);
private void FontListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label1.Font = new System.Drawing.Font(
fontListBox1.SelectedItem.ToString(), 11, System.Drawing.FontStyle.Regular);
}VB.NET:
vb
Imports Syncfusion.Windows.Forms.Tools
Dim fontListBox1 As New FontListBox()
fontListBox1.Size = New System.Drawing.Size(160, 94)
fontListBox1.UseAutoComplete = True
fontListBox1.SelectionMode = System.Windows.Forms.SelectionMode.One
AddHandler fontListBox1.SelectedIndexChanged, AddressOf FontListBox1_SelectedIndexChanged
Me.Controls.Add(fontListBox1)
Private Sub FontListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
label1.Font = New System.Drawing.Font(
fontListBox1.SelectedItem.ToString(), 11, System.Drawing.FontStyle.Regular)
End SubCommon Use Cases
常见使用场景
| Scenario | Properties to Set |
|---|---|
| Font picker for a text editor | |
| Multi-font selection | |
| Fast keyboard navigation | |
| Always show scrollbar | |
| Alphabetically sorted list | |
| Office-style appearance | |
| 场景 | 需要设置的属性 |
|---|---|
| 文本编辑器的字体选择器 | |
| 多字体选择 | |
| 快速键盘导航 | |
| 始终显示滚动条 | |
| 按字母顺序排序列表 | |
| Office风格外观 | |