You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
4.0 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// <copyright file="Program.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using GeoSigmaDrawLib;
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace PcgDrawR
{
/// <summary>
/// The program.
/// </summary>
internal static class Program
{
private enum PROCESS_DPI_AWARENESS
{
PROCESS_DPI_UNAWARE = 0,
PROCESS_SYSTEM_DPI_AWARE = 1,
PROCESS_PER_MONITOR_DPI_AWARE = 2,
}
[DllImport("SHCore.dll")]
private static extern bool SetProcessDpiAwareness(PROCESS_DPI_AWARENESS awareness);
/// <summary>
/// The main entry point for the application.
/// </summary>
/// <param name="args">启动参数 “/ZC”-块状显示散点</param>
[STAThread]
public static void Main(string[] args)
{
//DrawerData drawer = new DrawerData();
//drawer.OpenFile("c:\\temp\\k2.kev");
//IntPtr hBmp = drawer.GetBitmapHandle(2173, 1631, 0);
//System.Drawing.Bitmap image = System.Drawing.Image.FromHbitmap(hBmp);
////image.MakeTransparent(Color.White);
//image.Save("c:\\temp\\aaa.bmp");
//image.Dispose();
//drawer.DeleteHbmp(hBmp);
// 设置当前线程的文化为简体中文
//Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
//Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN");
// MessageBox.Show("启动程序");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
// 6.2 对应 win8、win server 2012 SetProcessDpiAwareness 至少要 win8 才有
NativeLibraryPathRegistrar.Register();
if (Environment.OSVersion.Version.Major >= 6.2)
{
SetProcessDpiAwareness(PROCESS_DPI_AWARENESS.PROCESS_SYSTEM_DPI_AWARE);
}
try
{
FileTypeRegister.RegistFileType(".kev", "金东方勘探开发分析平台");
FileTypeRegister.RegistFileType(".dfd", "金东方勘探开发分析平台");
}
catch (Exception ex)
{
if (ex is UnauthorizedAccessException)
{
// 用户未必有管理员权限,如果无法和文件后缀建关联,这个会反复弹窗,用户体验体验很差
// MessageBox.Show("未使用管理员权限启动,无法注册文件打开方式的关联!");
}
}
//WindowsFormsSettings.ForceDirectXPaint();
// DevExpress.UserSkins.BonusSkins.Register();
// DevExpress.Skins.SkinManager.EnableFormSkins();
DevExpress.Skins.SkinManager.EnableMdiFormSkins();
// DevExpress.Utils.Taskbar.Core.TaskbarAssistantCore.Initialize();
DevExpress.XtraEditors.WindowsFormsSettings.FontBehavior = DevExpress.XtraEditors.WindowsFormsFontBehavior.UseWindowsFont;
// WindowsFormsSettings.ThickBorderWidth = false;
// DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(SkinSvgPalette.Bezier.OfficeColorful);
SetupStyle();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain(args));
// Application.Run(new FormTestLic());
}
private static void SetupStyle()
{
//SetCulture("zh-Hans");
BonusSkins.Register();
DevExpress.Skins.SkinManager.EnableFormSkins();
DevExpress.Skins.SkinManager.EnableMdiFormSkins();
//UserLookAndFeel.Default.SetSkinStyle(SkinSvgPalette.Bezier.Default);
UserLookAndFeel.Default.SetSkinStyle(SkinStyle.VisualStudio2013Light);
}
}
}