提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|行业资讯|编辑:龚雪|2020-04-14 09:49:36.290|阅读 409 次
概述:本文将主要为大家介绍DevExpress WinForms产品组合中高价值实用程序控件——Message Boxes,WinForms Message Box控件将在即将发布的v20.1中发布!
#慧都22周年庆大促·界面/图表报表/文档/IDE/IOT/测试等千款热门软控件火热促销中>>
相关链接:
下载DevExpress v19.2完整版 DevExpress v19.2汉化资源获取
DevExpress Winforms Controls 内置140多个UI控件和库,完美构建流畅、美观且易于使用的应用程序。想要体验?点击下载>>
Message Boxes是DevExpress WinForms产品组合中高价值实用程序控件的完美示例。由于大多数应用程序都是通过消息框与用户进行通信的,所以WinForms Message Box控件将在即将发布的v20.1中出现,本文主要将为大家阐述此功能。
DevExpress XtraMessageBox对象与默认的WinForms消息相对应,XtraMessageBox的主要优势在于其使用DevExpress应用程序皮肤的功能,尽管这是一个重要的优势,但这绝不是XtraMessageBox的唯一优势。
虽然您可以使用标准方法显示消息(将文本字符串和按钮设置为静态XtraMessageBox.Show()方法重载),但您也可以创建XtraMessageBoxArgs对象并将其作为唯一的Show方法参数传递。 此对象允许您合并其他操作,例如您可以显示嵌入式计时器到期时自动关闭的消息。
XtraMessageBoxArgs args = new XtraMessageBoxArgs();
args.AutoCloseOptions.Delay = 5000;
args.Caption = "Auto-close message";
args.Text = "This message closes automatically after 5 seconds.";
args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel };
//show a countdown on a default button
args.AutoCloseOptions.ShowTimerOnDefaultButton = true;
XtraMessageBox.Show(args);
XtraMessageBoxArgs.Showing事件允许您在屏幕上显示消息表单之前对其进行访问和修改,您可以将其用于各种各样的事情,例如限制消息宽度。
XtraMessageBoxArgs args = new XtraMessageBoxArgs();
args.Caption = "A very long message";
args.Text = "A message box attempts to show all of its text content in one line. " +
"If you do not limit the form size, this message will be very long and thin. " +
"Set the maximum form width and the form will wrap this long text.";
args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel};
args.Showing += Args_Showing;
XtraMessageBox.Show(args);
private void Args_Showing(object sender, XtraMessageShowingArgs e)
{
e.Form.MaximumSize = new Size(600, 600);
}
...或自定义消息按钮(更改标题或向其提供矢量图像)。
XtraMessageBoxArgs args = new XtraMessageBoxArgs();
args.Caption = "A message with icons";
args.Text = "This message displays custom SVG images in its buttons";
args.Buttons = new DialogResult[] {
DialogResult.OK, DialogResult.Cancel, DialogResult.Retry };
args.Showing += Args_Showing;
XtraMessageBox.Show(args);
void Args_Showing(object sender, XtraMessageShowingArgs e) {
foreach (var control in e.Form.Controls)
{
SimpleButton button = control as SimpleButton;
if (button != null)
{
button.ImageOptions.SvgImageSize = new Size(16, 16);
button.ImageOptions.ImageToTextAlignment = ImageAlignToText.LeftCenter;
//button.Height = 25;
switch (button.DialogResult)
{
case (DialogResult.OK):
button.ImageOptions.SvgImage = svgImageCollection1[0];
break;
case (DialogResult.Cancel):
button.ImageOptions.SvgImage = svgImageCollection1[1];
break;
case (DialogResult.Retry):
button.ImageOptions.SvgImage = svgImageCollection1[2];
break;
}
}
}
}
使用v20.1,您将能够轻松地在消息中包含"Do not show this message again" 复选框,如果您想在项目中加入此功能,只需将布尔值XtraMessageBoxArgs.DoNotShowAgainCheckBoxVisible设置为true,复选框文本也是可自定义的。
XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.Caption = "Message"; args.Text = "You are using a trial version. The trial period expires in 30 days"; args.DoNotShowAgainCheckBoxVisible = true; args.DoNotShowAgainCheckBoxText = "Do not remind me again"; XtraMessageBox.Show(args);
此复选框本身不会执行任何操作,当消息出现在屏幕上(或被消除)时,它将引发Load和Closed事件。 您需要处理这些事件来存储和检索e.Visible属性值,此属性值指定用户是否选择隐藏消息。如果Load事件参数收到e.Visible属性值为false,则该消息被取消。
args.Load += Args_Load;
args.Closed += Args_Closed;
void Args_Closed(object sender, XtraMessageBoxClosedArgs e) {
//save e.Visible to a database or a local storage file
}
void Args_Load(object sender, XtraMessageBoxLoadArgs e) {
//retireve the value from a database or a local storage file
e.Visible = value;
}
与e.Visible一起,您还可以存储e.DialogResult属性值,它对应于关闭消息时使用的最后一个已知DialogResult。如果消息被抑制,则可以使用此值,以便Show方法返回上一个用户选择,而不是DialogResult.None。
void Args_Load(object sender, XtraMessageBoxLoadArgs e) {
e.Visible = _restoredVisibleValue_;
if (!e.Visible)
{
//restore the e.DialogResult property
e.DialogResult = _restoredDialogResultValue_;
}
}
对于那些不想手动保存和还原这些参数的用户,为您提供将其存储在注册表中的选项。 为此,请在Closed事件上调用SaveToRegistry方法,并在加载时调用RestoreFromRegistry。
void Args_Closed(object sender, XtraMessageBoxClosedArgs e) {
e.SaveToRegistry();
}
void Args_Load(object sender, XtraMessageBoxLoadArgs e) {
e.RestoreFromRegistry();
}
此代码将DialogResult和Visible键保存在Computer \ HKEY_CURRENT_USER \ Software \ X \ Y路径下,其中:
最后即使用户选择隐藏消息,也可以强制显示消息。 为此请在Load事件处理程序中调用e.ShowMessage方法,布尔方法参数指定是否应选中"Do not show again" 复选框。
DevExpress Dashboard控件实操公开课4月即将开启,
DevExpress技术交流群:540330292 欢迎一起进群讨论
扫描关注DevExpress中文网微信公众号,及时获取最新动态及最新资讯
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@hmdbvip.cn
文章转载自:慧都网



在现代复杂系统开发中,大型项目面临着需求频繁变更、技术复杂性高、团队协作困难、系统可追溯性差等多重挑战。Sparx Systems Enterprise Architect作为一款领先的UML全生命周期建模平台,通过提供统一的建模环境和贯穿从概念到退役的完整工具链,为大型项目提供了至关重要的战略支撑。
HOOPS SDK系列(包括HOOPS Visualize、HOOPS Exchange、HOOPS Communicator等)为开发者提供从图形渲染、3D数据解析到可视化交互的完整工具链,帮助机器人制造商在有限周期内构建出媲美行业顶级标准的专业应用,实现软硬件的最佳融合。
在接到客户投诉的那一刻,工厂最怕的不是质量问题本身,而是查不清来路:同一批次的成品到底是谁做的?用了哪批原料?哪道工序出了问题?
HOOPS Exchange是Tech Soft 3D提供的行业领先CAD数据访问引擎,支持超过30种主流CAD文件格式的导入与导出,完整保留几何结构、装配层级、PMI注释与工程属性
相关产品
优秀的界面控件开发包,帮助企业构建卓越应用!
DevExpress WinForms Subscription为Windows Forms平台创建具有影响力的业务解决方案,高性价比WinForms界面控件套包。
最新文章 MORE
永利最大(官方)网站相关的文章 MORE
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@hmdbvip.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
永利最大(官方)网站