DevExpress WinForms拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!
DevExpress WinForms控件v25.1日前已经全新发布,新版本的Ribbon、PDF Viewer(查看器)等组件功能全新升级等,欢迎下载最新版体验!
折叠(Accordion)
v25.1版本将DevExpress WinForms Accordion(折叠)控件与装饰器UI管理器集成在一起,来帮助显示徽章/提示并突出显示特定的折叠UI元素。

C#
cs
using System.Drawing;
using DevExpress.Utils.VisualEffects;
// ...
Badge badgeInbox;
public Form1() {
InitializeComponent();
badgeInbox = new Badge();
// Assign the badge to the 'Inbox' accordion item.
badgeInbox.TargetElement = accordionItemInbox;
// Specify badge text.
badgeInbox.Properties.Text = "17";
// Specify badge location and offset.
badgeInbox.Properties.Location = ContentAlignment.TopLeft;
badgeInbox.Properties.Offset = new Point(85, 6);
// Customize badge appearance.
badgeInbox.Appearance.BackColor = Color.Gray;
badgeInbox.Appearance.BorderColor = Color.Gray;
badgeInbox.Appearance.ForeColor = Color.White;
badgeInbox.Appearance.Font = new Font("Tahoma", 8.25F, FontStyle.Bold);
// Add the badge to the AdornerUIManager.
adornerUIManager1.Elements.Add(badgeInbox);
}
Ribbon & Bars
BarToggleSwitchItem - 切换开关宽度
在v25.1中,您可以指定切换开关栏项的宽度,使用EditorToThumbWidthRatio属性设置项目的总宽度相对于拇指的宽度。

Visual Studio 2010、Office 2013等具有类似视觉样式的皮肤会将拇指渲染为矩形,为了支持这些皮肤,官方添加了ThumbWidth属性。在这些皮肤中,切换开关编辑器的总体宽度计算为ThumbWidth和EditorToThumbWidthRatio属性值的乘积。

处理栏项目的右键单击
DevExpress WinForms栏管理器和Ribbon控件现在支持对栏项进行右键操作,新事件包括:
新版本还引入了一个新的e.MouseButton事件参数,它允许您识别按下的鼠标按钮。
Ribbon - 禁用双击最小化
您现在可以通过双击最小化DevExpress WinForms Ribbon,此操作由AllowMinimizeRibbonOnDoubleClick属性控制,将此属性设置为false来禁用双击最小化。
最大化/最小化Ribbon
新的API包括:
- MaximizeRibbon(RibbonPage) - 展开最小化的Ribbon。
- RibbonControl.AllowMinimizeRibbonOnDoubleClick - 指定用户是否可以通过双击页面标题来最小化Ribbon。
识别栏项和栏链接
新的API包括:
- BarManager.GetItemAt(Point) - 标识指定屏幕坐标处的栏项。
- BarManager.GetLinkAt(Point) - 在指定的屏幕坐标上标识BarItemLink。
C#
cs
barManager.ItemClick += (sender, e) => {
BarItem item = barManager.GetItemAt(Cursor.Position);
BarItemLink itemLink = barManager.GetLinkAt(Cursor.Position);
Debug.WriteLine(item.Caption);
Debug.WriteLine(itemLink.Caption);
};
PDF Viewer
AI驱动的操作
您现在可以在DevExpress WinForms PDF Viewer中使用AI驱动的总结、翻译和询问AI功能,还可以使用PDF Viewer的上下文菜单访问所需的AI操作。
DevExpress WinForms PDF Viewer的AI驱动操作具有相同的先决条件,并利用与WinForms产品线中其他AI扩展相同的集成机制。

保存时保留压缩对象流
新压缩引擎保留PDF对象流的原始(压缩)状态。
PDF编校API
v25.1包括用于创建和管理PDF编校注释的新API,这个新功能允许您从文档中隐藏或删除敏感或私人内容,并在编辑区域中添加彩色文本覆盖。
编校过程包括两个步骤:
- 在PDF页面区域中创建具有所需外观的编校注释(如果希望隐藏内容但为其他用户保留内容,则很有用)。
- 使用注释清除内容,并使用指定的外观设置应用覆盖。在这种情况下,所有隐藏的内容都将被删除。
注意:编校支持可以通过PDF Facade API (DevExpress.Pdf. PdfDocumentFacade类)获得,该类在DevExpress.Docs.v25.1.dll程序集中定义。将此程序集添加到您的项目中,或者从离线包源中安装DevExpress.Document.Processor NuGet包来使用PdfDocumentFacade成员。
在代码中创建和应用编校注释
要创建编校注释,请遵循以下步骤:
- 使用PdfViewerControl.GetDocumentFacade扩展方法来获取DevExpress.Pdf.PdfDocumentFacade实例。
- 从PdfDocumentFacade.Pages集合中检索所需的PDF页面。
- 调用PdfPageFacade.AddRedactAnnotation 方法,该方法返回PdfRedactAnnotationFacade对象,并允许您修改编校注释的以下外观设置:背景颜色、覆盖文本、文本字体设置(字体名称、颜色、大小和样式)、文本重复和对齐。
新的API允许您应用以下注释:
- 单一编校注释:PdfRedactAnnotationFacade.Apply
- 特定页面的所有编校注释: PdfPageFacade.ApplyRedactAnnotations
- 整个文档中的所有编校注释:PdfDocumentFacade.ApplyRedactAnnotations
当您应用编校时,也可以使用 DevExpress.Pdf.PdfClearContentOptions 来指定要删除的内容类型(文本、图形、图像或注释)。
C#
cs
pdfViewer.LoadDocument("Demo.pdf");
//...
PdfDocumentFacade documentFacade = pdfViewer.GetDocumentFacade();
PdfRectangle pageCropBox = pdfViewer.GetPageInfo(0).CropBox;
PdfRectangle redactBounds =
new PdfRectangle(0, pageCropBox.Height-50, 200, pageCropBox.Height);
// Add a redaction annotation at the top left corner of the first document page.
PdfRedactAnnotationFacade redactAnnotation =
documentFacade.Pages[0].AddRedactAnnotation(redactBounds);
redactAnnotation.Author = "Jane Doe";
// Setup redaction annotation appearance
redactAnnotation.FillColor = new PdfRGBColor(0, 0, 0);
redactAnnotation.FontColor = new PdfRGBColor(1, 1, 1);
redactAnnotation.FontName = "Calibri";
redactAnnotation.FontSize = 0; // enables font auto-size
redactAnnotation.OverlayText = "Classified";
redactAnnotation.TextJustification = PdfTextJustification.Centered;
redactAnnotation.RepeatText = false;
// Apply the redaction annotation.
redactAnnotation.Apply();