没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|使用教程|编辑:龚雪|2022-11-16 10:13:37.813|阅读 130 次
概述:本文将介绍如何使用DevExpress WinForm控件在应用程序启动时执行操作,欢迎下载最新版组件产品体验~
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
DevExpress WinForm拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForm能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!
在打开主应用程序表单之前,开发人员可能需要在代码中执行某些操作。例如要启用DirectX硬件加速,开发人员需要在创建应用程序表单之前调用WindowsFormsSettings.ForceDirectXPaint方法。
本文将为大家演示在使用C#和Visual Basic开发项目时,可以将应用程序初始化代码放置在何处。如果您是一个Visual Basic开发人员,可以根据需求选择下面列出方法当中的一种。
对于C#项目,在Solution Explorer中找到Program.cs文件,该文件包含void Main()过程,开发人员可以在Application.Run方法调用之前在其中添加自定义代码。
C#
using DevExpress.XtraEditors; using System; using System.Windows.Forms; namespace WindowsFormsApplication1 { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { //Add your code here WindowsFormsSettings.ForceDirectXPaint(); WindowsFormsSettings.EnableFormSkins(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }
使用这种方法,开发人员可以创建一个Main函数并将其设置为应用程序的入口点。
1. 在Solution Explorer中右键单击您的项目,然后在上下文菜单中选择Properties。
2. 取消选中Enable application framework,然后在Application选项卡中将Startup object设置为Sub Main。
3. 切换到主窗体的代码编辑器,手动将以下Shared Sub Main过程添加到窗体类中:
VB.NET
Public Class Form1 Shared Sub Main() Application.EnableVisualStyles() Application.SetCompatibleTextRenderingDefault(False) Application.Run(New Form1) 'Specify the startup form End Sub End Class
4. 在Application.Run方法调用之前插入要执行的代码。
VB.NET
Public Class Form1 Shared Sub Main() 'Add your code here DevExpress.XtraEditors.WindowsFormsSettings.ForceDirectXPaint() DevExpress.XtraEditors.WindowsFormsSettings.EnableFormSkins() Application.EnableVisualStyles() Application.SetCompatibleTextRenderingDefault(False) Application.Run(New Form1) 'Specify the startup form End Sub End Class
通过这种方法,您可以订阅应用程序的Startup事件来执行自定义操作。
1. 在Solution Explorer中右键单击您的项目,然后在上下文菜单中选择Properties。
2. 在Application选项卡中单击View Application Events按钮。
3. 订阅打开的ApplicationEvents.vb文件中的Startup事件。
4. 在生成的Startup事件处理程序中插入要执行的代码。
VB.NET
Imports DevExpress.XtraEditors Imports Microsoft.VisualBasic.ApplicationServices Namespace My ' The following events are available for MyApplication: ' Startup: Raised when the application starts, before the startup form is created. ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally. ' UnhandledException: Raised if the application encounters an unhandled exception. ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected. Partial Friend Class MyApplication Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup 'Add your code here WindowsFormsSettings.ForceDirectXPaint() WindowsFormsSettings.EnableFormSkins() End Sub End Class End Namespace
DevExpress技术交流群6:600715373 欢迎一起进群讨论
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@wqylolg.cn
文章转载自:慧都网从版本2025.2.2开始, Stimulsoft 产品中引入了一个新的关系参数JoinType 。它定义了两个数据源之间的连接类型。在本文中,我们将深入探讨如何使用此参数。
本文将详细介绍如何使用 C# 和 Spire.XLS for .NET 库将 Excel XLS 或 XLSX 文件转换为 Markdown 格式。
Webix 是一套完整的前端开发框架,它允许开发者利用 JavaScript、CSS 和 HTML5 技术,快速构建出富交互性的 Web 应用程序。该框架提供了超过 100 个预制且可高度定制的组件,涵盖了数据表格、图表、表单、布局等各类常见的用户界面元素。无论是经验丰富的专业开发者,还是初涉 Web 开发领域的新手,都能从 Webix 的易用性和强大功能中受益。
CAD VCL Multiplatform是一个高质量的多功能源代码库,可用于 Delphi 和 C++Builder 应用程序。支持 2D 和 3D CAD 格式,包括DWG、DXF、 HPGL PLT、HGL、STEP、IGES、STL、ACIS SAT、BREP、CGM、SVG等。该产品不需要安装 AutoCAD® 或其他附加应用程序。
优秀的界面控件开发包,帮助企业构建卓越应用!
DevExpress DXperience Subscription高性价比的企业级.NET用户界面套包,助力企业创建卓越应用!
DevExpress WinForms Subscription为Windows Forms平台创建具有影响力的业务解决方案,高性价比WinForms界面控件套包。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@wqylolg.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢