RaUI/Source/Itrycn_Project2/SkinForms/SKinForm.cs
鑫Intel a3f978b187 ### 2021-06-12更新
------
#### Itrycn_Project2    V1.0.2106.1201
- *.[新增]新增加入皮肤功能。
- *.[新增]对话框全部使用皮肤。
- *.[新增]新增加入扫描模板,快速开发扫描功能。
- *.[改进]公共变量进行区分设置,更加规范。
2021-06-12 22:09: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 RySkins
{
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 ThemeForm(); }
//Opacity = 0.97;
}
}
}