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.

108 lines
4.5 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 System;
using System.Runtime.InteropServices;
using System.Text;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using GeoSigmaDrawLib;
using Application = System.Windows.Forms.Application;
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();
//string strPath = "C:\\temp\\20250330\\HorizontalWell\\WellStage\\阳101井区五峰组底界天然裂缝分布图.kev";
////drawer.OpenWithDraw = true;
//drawer.OpenFile(strPath);
//MessageBox.Show("Finished");
//string strData = drawer.ToDfdString();
////System.Diagnostics.Trace.WriteLine(strData);
//System.Diagnostics.Trace.WriteLine(strData);
//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");
// 6.2 对应 win8、win server 2012 SetProcessDpiAwareness 至少要 win8 才有
if (Environment.OSVersion.Version.Major >= 6.2)
{
SetProcessDpiAwareness(PROCESS_DPI_AWARENESS.PROCESS_SYSTEM_DPI_AWARE);
}
// 注册字符编码,在 .NET 5+ 以后,某些编码支持需要显式添加
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
NativeLibraryPathRegistrar.Register();
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);
AvaloniaBootstrapper.EnsureInitialized();
Application.Run(new FormMain(args));
// Application.Run(new FormTestLic());
// Application.Run(new FrmMainTest());
}
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);
}
}
}