没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:龚雪|2021-01-08 11:51:15.563|阅读 430 次
概述:本文将为大家介绍如何在Telerik UI for WinForms套件中使用新的RadTaskDialog控件,以多种方式帮助您的用户。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
在Telerik UI for WinForms的R3 2020版本中,套件中添加了新的RadTaskDialog组件。 任务对话框是一个小窗口,它向用户显示信息并提示他们进行响应。 与常规消息框相比,任务对话框具有许多配置选项,可以显示其他UI元素(如单选按钮和进度条),并支持事件处理。
RadTaskDialog是Windows对话框和新发布的.NET 5的TaskDialog可替代选择,该对话框是一个窗口,允许用户执行命令、向用户提问、为用户提供信息或指示进度、正在进行的任务。RadTaskDialog代表标准System.Windows.Forms.MessageBox和RadMessageBox的扩展版本,与常规消息框相比,它可以显示其他控件,例如进度条,并支持事件处理。
它有一个包含所有必要用户信息的主要元素 - RadTaskDialogPage,RadTaskDialogPage公开了一些有用的属性,这些属性使您可以仅用几行代码来设置整个对话框:
在描述了对话框的主要功能之后,就该展示一些用例了。 但是在此之前,我们需要澄清两件重要的事情:
这是PDF文件移动期间的示例案例,用户必须决定是替换原始文件,取消还是保留两个文件。
这是代码,大多数行用于配置命令链接按钮:
RadTaskDialogPage page = new RadTaskDialogPage() { SizeToContent = true, Icon = RadTaskDialogIcon.ShieldBlueBar, Caption = "Move File", Heading = "There is already a file with the same name in this location.", Text = "Click the file you want to keep", CommandAreaButtons = { RadTaskDialogButton.Cancel }, AllowCancel = true, UseWideContentArea = true }; RadSvgImage pdfIcon = RadSvgImage.FromFile(@"..\..\Resources\file-pdf.svg"); pdfIcon.Size = new Size(50, 50); RadTaskDialogCommandLinkButton moveButton = new RadTaskDialogCommandLinkButton( "Move and Replace", @"Replace the file in the destination folder with the file you are moving:" + Environment.NewLine + "document.pdf" + Environment.NewLine + "Size: 275 KB" + Environment.NewLine + "Date Modified: 11.11.2018 12:45"); moveButton.SvgImage = pdfIcon; page.ContentAreaButtons.Add(moveButton); RadTaskDialogCommandLinkButton dontMoveButton = new RadTaskDialogCommandLinkButton( "Don't move", @"Replace the file in the destination folder with the file you are moving:" + Environment.NewLine + "document.pdf" + Environment.NewLine + "Size: 275 KB" + Environment.NewLine + "Date Modified: 11.11.2018 12:45"); dontMoveButton.SvgImage = (RadSvgImage)pdfIcon.Clone(); page.ContentAreaButtons.Add(dontMoveButton); RadTaskDialogCommandLinkButton keepBothButton = new RadTaskDialogCommandLinkButton( "Move, but keep both files", "The file you are moving will be renamed 'document(2).pdf'"); page.ContentAreaButtons.Add(keepBothButton); RadTaskDialogButton clickedButton = RadTaskDialog.ShowDialog(page); if (clickedButton == null || clickedButton == RadTaskDialogButton.Cancel) { // the user cancelled the action } else if (clickedButton == moveButton) { // move and replace } else if (clickedButton == dontMoveButton) { // do not move } else if (clickedButton == keepBothButton) { // move and keep both files }
另一个有趣的情况是您需要创建一个多页对话框。 要切换页面,您只需要调用当前显示的RadTaskDialogPage的Navigate方法。
这是打印机安装示例:
RadTaskDialogButton initialButtonYes = RadTaskDialogButton.Continue; initialButtonYes.Enabled = false; initialButtonYes.AllowCloseDialog = false; RadTaskDialogPage initialPage = new RadTaskDialogPage() { Caption = "Hardware Installation", Heading = "Installation Warning", Text = "The software you are installing for this hardware:\nPrinters\nhas not passed Windows Logo testing to verify its compatibility with Windows", Icon = RadTaskDialogIcon.ShieldWarningYellowBar, AllowCancel = true, Verification = new RadTaskDialogVerificationCheckBox() { Text = "Install anyway" }, CommandAreaButtons = { initialButtonYes, RadTaskDialogButton.Cancel }, DefaultButton = RadTaskDialogButton.Cancel }; RadTaskDialogPage inProgressPage = new RadTaskDialogPage() { Caption = "Hardware Installation", Heading = "Installation in progress...", Text = "Please wait while the installation is in progress.", Icon = RadTaskDialogIcon.Information, ProgressBar = new RadTaskDialogProgressBar() { State = RadTaskDialogProgressBarState.Marquee }, Expander = new RadTaskDialogExpander() { Text = "Initializing...", Position = RadTaskDialogExpanderPosition.AfterFootnote }, CommandAreaButtons = { RadTaskDialogButton.Cancel } }; RadTaskDialogPage finishedPage = new RadTaskDialogPage() { Caption = "Hardware Installation", Heading = "Success!", Text = "The Printer installation completed successfully.", Icon = RadTaskDialogIcon.ShieldSuccessGreenBar, CommandAreaButtons = { new RadTaskDialogButton("Finish") } }; RadTaskDialogVerificationCheckBox checkBox = initialPage.Verification; checkBox.CheckedChanged += (sender, e) => { initialButtonYes.Enabled = checkBox.Checked; }; initialButtonYes.Click += (sender, e) => { initialPage.Navigate(inProgressPage); }; inProgressPage.Created += delegate (object s, EventArgs e) { RadTaskDialogProgressBar progressBar = inProgressPage.ProgressBar; Timer timer = new Timer(); timer.Interval = 2800; int progressValue = 0; timer.Start(); timer.Tick += delegate (object sender, EventArgs args) { timer.Interval = 40; if (progressBar.State == RadTaskDialogProgressBarState.Marquee) { progressBar.State = RadTaskDialogProgressBarState.Normal; } progressBar.Value = progressValue; inProgressPage.Expander.Text = string.Format("Installation Progress: {0} %", progressValue); if (progressValue == 100) { timer.Stop(); timer.Dispose(); inProgressPage.Navigate(finishedPage); } progressValue++; }; };
最后,技术团队还组件了三组不同的矢量图标:渐变、平面和白色:
我们添加了三种不同的方法,这些方法根据内部需求返回不同的格式和大小。 要访问这些图像,可以使用以下代码:
// Returns a vector image RadSvgImage svgIcon = RadTaskDialogIcon.GetSvgImage(RadTaskDialogIconImage.FlatShieldQuestion); // Returns a raster image with size 16x16px Image smallIcon = RadTaskDialogIcon.GetSmallImage(RadTaskDialogIconImage.FlatShieldQuestion); // Returns a raster image with size 26x26px Image largeIcon = RadTaskDialogIcon.GetLargeImage(RadTaskDialogIconImage.FlatShieldQuestion);
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@wqylolg.cn
文章转载自:慧都网FastReport .NET 的主要功能之一是能够将多份报告合并为一份。当您需要合并来自不同来源的数据或以更方便的格式呈现信息时,此功能非常有用。在本文中,我们将讨论如何在 FastReport .NET 中将多份报告合并为一份。
本文将手把手教你如何用VMProtect对这一关键函数进行虚拟化保护,大幅提升代码安全性,让逆向工程攻击者无从下手!
在 PDF 文档中添加页眉和页脚有助于保持一致的版式和专业的外观。本文将介绍如何使用 Spire.PDF for Java,通过 Java 在现有的 PDF 文档中添加页眉和页脚,并提供详细的步骤和代码示例。
对于开发人员来说,由于自动化和定制化,通常首选使用编程方法来去除 PDF 中的水印。Aspose.PDF 提供可靠且可定制的解决方案,可无缝集成到各种应用程序中,确保准确性并保持文档完整性。
拥有适用Windows Forms的110+个酷炫UI控件。
Telerik DevCraft最完整的.NET、Web和Mobile开发工具,智能制造首选控件。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@wqylolg.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢