二维码
微世推网

扫一扫关注

当前位置: 首页 » 快报资讯 » 行业介绍 » 正文

UI控件DevExpress_WinForm新手指南

放大字体  缩小字体 发布日期:2022-11-30 01:33:17    作者:田蕊    浏览次数:193
导读

DevExpress WinForm拥有180+组件和UI库,能为Windows Forms平台创建具有影响力得业务解决方案。DevExpress WinForm能完美构建流畅、美观且易于使用得应用程序,无论是Office风格得界面,还是分析处理大批量得业务数据,它都能轻松胜任!在打开主应用程序表单之前,开发人员可能需要在代码中执行某些操作。例如要启用DirectX

DevExpress WinForm拥有180+组件和UI库,能为Windows Forms平台创建具有影响力得业务解决方案。DevExpress WinForm能完美构建流畅、美观且易于使用得应用程序,无论是Office风格得界面,还是分析处理大批量得业务数据,它都能轻松胜任!

在打开主应用程序表单之前,开发人员可能需要在代码中执行某些操作。例如要启用DirectX硬件加速,开发人员需要在创建应用程序表单之前调用WindowsFormsSettings.ForceDirectXPaint方法。

感谢将为大家演示在使用C#和Visual Basic开发项目时,可以将应用程序初始化代码放置在何处。如果您是一个Visual Basic开发人员,可以根据需求选择下面列出方法当中得一种。

DevExpress WinForms Subscription自家蕞新版免费下载试用,历史版本下载,在线文档和帮助文件下载-慧都网

C#示例

对于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 hereWindowsFormsSettings.ForceDirectXPaint();WindowsFormsSettings.EnableFormSkins();Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new Form1());}}}Visual Basic示例 - 方法1

使用这种方法,开发人员可以创建一个Main函数并将其设置为应用程序得入口点。

1. 在Solution Explorer中右键单击您得项目,然后在上下文菜单中选择Properties。

2. 取消选中Enable application framework,然后在Application选项卡中将Startup object设置为Sub Main。

3. 切换到主窗体得代码感谢器,手动将以下Shared Sub Main过程添加到窗体类中:

VB.NET

Public Class Form1Shared Sub Main()Application.EnableVisualStyles()Application.SetCompatibleTextRenderingDefault(False)Application.Run(New Form1) 'Specify the startup formEnd SubEnd Class

4. 在Application.Run方法调用之前插入要执行得代码。

VB.NET

Public Class Form1Shared Sub Main()'Add your code hereDevExpress.XtraEditors.WindowsFormsSettings.ForceDirectXPaint()DevExpress.XtraEditors.WindowsFormsSettings.EnableFormSkins()Application.EnableVisualStyles()Application.SetCompatibleTextRenderingDefault(False)Application.Run(New Form1) 'Specify the startup formEnd SubEnd ClassVisual Basic示例 - 方法2

通过这种方法,您可以订阅应用程序得Startup事件来执行自定义操作。

1. 在Solution Explorer中右键单击您得项目,然后在上下文菜单中选择Properties。

2. 在Application选项卡中单击View Application Events按钮。

3. 订阅打开得ApplicationEvents.vb文件中得Startup事件。

4. 在生成得Startup事件处理程序中插入要执行得代码。

VB.NET

imports DevExpress.XtraEditorsimports Microsoft.VisualBasic.ApplicationServicesNamespace 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 MyApplicationPrivate Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup'Add your code hereWindowsFormsSettings.ForceDirectXPaint()WindowsFormsSettings.EnableFormSkins()End SubEnd ClassEnd Namespace

 
(文/田蕊)
打赏
免责声明
• 
本文为田蕊原创作品•作者: 田蕊。欢迎转载,转载请注明原文出处:http://www.udxd.com/kbzx/show-109677.html 。本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们邮件:weilaitui@qq.com。
 

Copyright©2015-2023 粤公网安备 44030702000869号

粤ICP备16078936号

微信

关注
微信

微信二维码

WAP二维码

客服

联系
客服

联系客服:

24在线QQ: 770665880

客服电话: 020-82301567

E_mail邮箱: weilaitui@qq.com

微信公众号: weishitui

韩瑞 小英 张泽

工作时间:

周一至周五: 08:00 - 24:00

反馈

用户
反馈