没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|使用教程|编辑:龚雪|2021-04-06 10:22:50.957|阅读 302 次
概述:本文主要介绍DevExpress表单控件的覆盖表单,覆盖表单执行半透明启动屏幕。欢迎下载最新版DevExpress体验!
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
覆盖表单是执行以下操作的半透明启动屏幕:
注意:运行Overlay Form module in the XtraEditors MainDemo来查看正在使用的表单,单击功能区中的Open Solution获取源代码。
调用 方法来在控件或表单上显示覆盖表单,该方法返回一个句柄,您可以将其传递给 方法以关闭表单。
下面的代码显示在应用程序执行长时间运行的操作时如何在当前表单上显示覆盖表单。
C#
using DevExpress.XtraSplashScreen;
//...
IOverlaySplashScreenHandle ShowProgressPanel() {
return SplashScreenManager.ShowOverlayForm(this);
}
void CloseProgressPanel(IOverlaySplashScreenHandle handle) {
if(handle != null)
SplashScreenManager.CloseOverlayForm(handle);
}
//...
IOverlaySplashScreenHandle handle = null;
try {
handle = ShowProgressPanel();
// Launch a long-running operation while
// the Overlay Form overlaps the current form.
}
finally {
CloseProgressPanel(handle);
}
VB.NET
Imports DevExpress.XtraSplashScreen '... Private Function ShowProgressPanel() As IOverlaySplashScreenHandle Dim handle As IOverlaySplashScreenHandle = SplashScreenManager.ShowOverlayForm(Me) Return handle End Function Private Sub CloseProgressPanel(ByVal handle As IOverlaySplashScreenHandle) If handle IsNot Nothing Then SplashScreenManager.CloseOverlayForm(handle) End Sub '... Dim Handle As IOverlaySplashScreenHandle = Nothing Try Handle = ShowProgressPanel() 'Launch a long-running operation while 'the Overlay Form overlaps the main form. Finally CloseProgressPanel(Handle) End Try
警告:您只能在已初始化(创建其句柄)的控件/表单上显示覆盖表单;否则将抛出,请参见 。
方法允许您显示具有以下参数的覆盖表单:
所有这些参数都是可选的。 如果省略参数,则使用默认值。 不带选项的方法使用静态(在VB中共享)默认选项。
下面的代码显示了如何显示带有自定义参数的覆盖表单。
C#
using DevExpress.XtraSplashScreen; OverlayWindowOptions options = new OverlayWindowOptions( startupDelay: 1000, backColor: Color.Red, opacity: 0.5, fadeIn: false, fadeOut: false, imageSize: new Size(64, 64) ); IOverlaySplashScreenHandle handle1 = SplashScreenManager.ShowOverlayForm(gridControl1, options); IOverlaySplashScreenHandle handle2 = SplashScreenManager.ShowOverlayForm( owner: gridControl1, startupDelay: 1000, backColor: Color.Red, opacity: 127, fadeIn: false, fadeOut: false, imageSize: new Size(64, 64) );
VB.NET
Imports DevExpress.XtraSplashScreen Dim options As New OverlayWindowOptions( startupDelay:=1000, backColor:=Color.Red, opacity:=0.5, fadeIn:=False, fadeOut:=False, imageSize:=New Size(64, 64) ) Dim formHandle1 As IOverlaySplashScreenHandle = SplashScreenManager.ShowOverlayForm(gridControl1, options) Dim formHandle2 As IOverlaySplashScreenHandle = SplashScreenManager.ShowOverlayForm( owner:=gridControl1, startupDelay:=1000, backColor:=Color.Red, opacity:=127, fadeIn:=False, fadeOut:=False, imageSize:=New Size(64, 64) )
您可以按以下方式呈现重叠表单:
下面的代码段显示了如何显示自定义消息,如下图所示:
C#
using DevExpress.XtraSplashScreen;
using DevExpress.Utils.Drawing;
using System.Drawing;
//...
class CustomOverlayPainter : OverlayWindowPainterBase
{
// Defines the string’s font.
static readonly Font drawFont;
static CustomOverlayPainter() {
drawFont = new Font("Tahoma", 18);
}
protected override void Draw(OverlayWindowCustomDrawContext context)
{
//The Handled event parameter should be set to true.
//to disable the default drawing algorithm.
context.Handled = true;
//Provides access to the drawing surface.
GraphicsCache cache = context.DrawArgs.Cache;
//Adjust the TextRenderingHint option
//to improve the image quality.
cache.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
//Overlapped control bounds.
Rectangle bounds = context.DrawArgs.Bounds;
//Draws the default background.
context.DrawBackground();
//Specify the string that will be drawn on the Overlay Form instead of the wait indicator.
String drawString = "Please wait...";
//Get the system's black brush.
Brush drawBrush = Brushes.Black;
//Calculate the size of the message string.
SizeF textSize = cache.CalcTextSize(drawString, drawFont);
//A point that specifies the upper-left corner of the rectangle where the string will be drawn.
PointF drawPoint = new PointF(
bounds.Left + bounds.Width / 2 - textSize.Width / 2,
bounds.Top + bounds.Height / 2 - textSize.Height / 2
);
//Draw the string on the screen.
cache.DrawString(drawString, drawFont, drawBrush, drawPoint);
}
}
//...
IOverlaySplashScreenHandle handle = SplashScreenManager.ShowOverlayForm(this, customPainter: new CustomOverlayPainter());
VB.NET
Imports DevExpress.Utils.Drawing
Imports DevExpress.XtraSplashScreen
Imports System.Drawing
'...
Class CustomOverlayPainter
Inherits OverlayWindowPainterBase
'Defines the string’s font.
Shared ReadOnly drawFont As Font
Shared Sub New()
drawFont = New Font("Tahoma", 18)
End Sub
Protected Overrides Sub Draw(context As OverlayWindowCustomDrawContext)
'The Handled event parameter should be set to true
'to disable the default drawing algorithm.
context.Handled = True
'Provides access to the drawing surface.
Dim cache As GraphicsCache = context.DrawArgs.Cache
'Adjust the TextRenderingHint option
’to improve the image quality.
cache.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias
'Overlapped control bounds.
Dim bounds As Rectangle = context.DrawArgs.Bounds
'Draws the default background.
context.DrawBackground()
'Create the string to draw.
Dim drawString As String = "Please wait..."
'Get the system black brush.
Dim drawBrush As Brush = Brushes.Black
'Calculate the size of the message string.
Dim textSize As SizeF = cache.CalcTextSize(drawString, drawFont)
'A point that specifies the upper-left corner of the rectangle where the string should be drawn.
Dim drawPoint As PointF = New PointF(bounds.Left + bounds.Width / 2 - textSize.Width / 2, bounds.Top + bounds.Height / 2 - textSize.Height / 2)
'Draw the string on the screen.
cache.DrawString(drawString, drawFont, drawBrush, drawPoint)
End Sub
End Class
'...
Dim handle As IOverlaySplashScreenHandle = SplashScreenManager.ShowOverlayForm(Me, customPainter:=New CustomOverlayPainter())
DevExpress技术交流群3:700924826 欢迎一起进群讨论
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@fz165y.cn
文章转载自:慧都网



在使用Parasoft C/C++test执行BugDetective数据流分析时,可能会遇到用户自定义的资源API,那在这种情况下,若要判断是否存在资源问题,如资源泄露等,则需要手动配置测试配置。
大型SaaS系统的自动化测试常常受制于界面变化快、结构复杂、加载机制多变等因素。从元素识别到脚本管理,SmartBear TestComplete帮助Salesforce建了可靠的自动化测试体系。
BarTender 标签管理系统,正是帮助企业轻松实现 GS1 标准化标签设计、编码生成与信息联动的强大工具。
Parasoft C/C++test 是一款功能强大的 C/C++ 软件测试工具,集成了静态代码分析、单元测试、集成测试和覆盖率分析等功能,单元测试作为其关键功能之一,为了适配多样化的目标部署环境,C/C++test 设计了灵活的测试结果收集机制。通过Socket通讯方式来收集单元测试结果,从而扩展其测试覆盖范围与应用场景。
相关产品
优秀的界面控件开发包,帮助企业构建卓越应用!
DevExpress DXperience Subscription高性价比的企业级.NET用户界面套包,助力企业创建卓越应用!
DevExpress WinForms Subscription为Windows Forms平台创建具有影响力的业务解决方案,高性价比WinForms界面控件套包。
DevExpress WPF Subscription高效MVVM开发模式,WPF界面解决方案首选工具,帮助企业实现酷炫动效界面。
最新文章 MORE
星空最火知名网站相关的文章 MORE
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@fz165y.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
星空最火知名网站 