开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 3599|回复: 2

[教程] devexpress程序只允许一个实例,默认汉化DLL,设置默认主题等

[复制链接]

0

精华

0

贡献

2

赞扬

帖子
28
软币
195
在线时间
15 小时
注册时间
2014-8-28
发表于 2014-12-6 18:41:31 | 显示全部楼层 |阅读模式
本帖最后由 无心漫漫 于 2014-12-6 18:51 编辑

我就直接上代码了

--------------------------1,程序只允许一个实例,设置程序默认皮肤等------------------------------------------------------------
    static class Program
    {
        public static System.Threading.Mutex mutex;
        /// <summary>
        /// 应用程序的主入口点
        /// </summary>
       [STAThread]
        static void Main()
        {
            bool noRun = false;
            mutex = new System.Threading.Mutex(true, "ThisHTShouldOnlyRunOne", out noRun);
           if (noRun)
            {
                mutex.ReleaseMutex();
                System.Threading.Thread.CurrentThread.CurrentUICulture =
                    new System.Globalization.CultureInfo("zh-Hans");
                System.Threading.Thread.CurrentThread.CurrentCulture =
                    new System.Globalization.CultureInfo("zh-Hans");
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                DevExpress.Skins.SkinManager.EnableFormSkins();
                DevExpress.UserSkins.BonusSkins.Register();
                UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");
                Application.Run(new LoginXtraForm());
            }
            else
            {
                XtraMessageBox.Show("程序已经启动!");
                Application.Exit();
            }
        }
    }
---------------------2,显示启动动画窗体----------------------------------------
如何显示启动动画窗体?以下是代码

//在窗体构造函数中
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(SplashScreen1));//显示启动动画窗体,SplashScreen1为新添加的启动动画窗体
InitializeComponent();
System.Threading.Thread.Sleep(3000);//延时3秒看一下效果
//在窗体Form_Load函数中
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();//关闭启动动画窗体

----------------------3,当查询数据等时,显示等待数据正在查询中窗体-----------------------------------
//在点击查询事件开始时
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(WaitForm1));//显示等待窗体,WaitForm1为新添加的等待窗体
//在查询事件结束后
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();

评分

参与人数 1赞扬 +1 收起 理由
liqi2345241 + 1 Thanks

查看全部评分

回复

使用道具 举报

0

精华

0

贡献

0

赞扬

帖子
13
软币
209
在线时间
29 小时
注册时间
2014-12-5
发表于 2014-12-7 08:21:09 | 显示全部楼层
Thanksssssssssss...
回复

使用道具 举报

0

精华

486

贡献

4021

赞扬

正版授权组

Rank: 14Rank: 14Rank: 14Rank: 14

帖子
323
软币
18177
在线时间
4647 小时
注册时间
2013-8-28
发表于 2014-12-7 08:59:25 | 显示全部楼层
写的还是很不错的,学习了..
回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-5-6 06:34

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表