VSoft/Source/VSoft_Dll/Skins/SKinForm.cs
如果当时 64e190aa7b ### 2021-07-05更新
------
#### VSoft    V1.0.2107.0501
- *.[新增]新增适配原生64位系统。
- *.[修复]修复将侧键作为热键时,点击两个侧键都会激活软件的BUG。
- *.[修复]修复点击主界面中设置按钮,设置按钮没在父窗体居中的BUG。
- *.[修复]修复在右键菜单中无法编辑和新增软件的BUG。
- *.[修复]修复主界面右键菜单打开的窗体没居中的BUG。
2021-07-05 21:44:49 +08:00

56 lines
1.8 KiB
C#

using MGdu.WinFormUI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace VSoft.Skins
{
public partial class SKinForm : GMForm
{
public SKinForm()
{
InitializeComponent();
}
public SKinForm(string[] args)
{
InitializeComponent();
}
/// <summary>
/// 显示在父窗体中间,如果没有父窗体,则显示在显示器中间
/// </summary>
/// <param name="parent"></param>
public void ShowInCenter(Form parent)
{
this.StartPosition = FormStartPosition.Manual;
var screen = Screen.FromControl(this);
if (parent == null) //如果没有父窗体,则显示在显示器中间
{
Location = new Point((screen.WorkingArea.Width - Width) / 2, (screen.WorkingArea.Height - Height) / 2);
return;
}
var x = parent.Left + (parent.Width - Width) / 2;
var y = parent.Top + (parent.Height - Height) / 2;
if ((x + Width) > screen.WorkingArea.X + screen.WorkingArea.Width)
{
x = screen.WorkingArea.X + screen.WorkingArea.Width - Width;
}
if ((y + Height) > screen.WorkingArea.Y + screen.WorkingArea.Height)
{
y = screen.WorkingArea.Y + screen.WorkingArea.Height - Height;
}
Location = new Point(x, y);
}
private void SKinForm_Load(object sender, EventArgs e)
{
if (!this.DesignMode)
{ base.XTheme = new VSoft.Skins.ThemeForm(); }
//Opacity = 0.97;
}
}
}