📄 ximdialog.cs
字号:
namespace Imps.Client.Pc.BizControls
{
using Imps.Client.Pc;
using Imps.Client.Pc.Controls;
using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
public class XIMDialog : FormEx
{
protected int _BorderHeight;
protected int _BorderRectangleHeight;
protected int _BorderRectangleWidth;
protected int _BorderWidth;
private Rectangle _bottomBorder;
private Rectangle _bottomBorderRectangle;
private Rectangle _leftBorder;
private Rectangle _leftBorderRectangle;
private Rectangle _rightBorder;
private Rectangle _rightBorderRectangle;
private Rectangle _TopBorder;
private Rectangle _topBorderRectangle;
private bool _UseBorder;
protected static XDialogStyle style = new XDialogStyle();
public XIMDialog() : base(false, XFormStyle.Dialog)
{
this._topBorderRectangle = Rectangle.Empty;
this._TopBorder = Rectangle.Empty;
this._leftBorderRectangle = Rectangle.Empty;
this._leftBorder = Rectangle.Empty;
this._rightBorderRectangle = Rectangle.Empty;
this._rightBorder = Rectangle.Empty;
this._bottomBorderRectangle = Rectangle.Empty;
this._bottomBorder = Rectangle.Empty;
this._UseBorder = true;
this._BorderRectangleHeight = 3;
this._BorderHeight = 1;
this._BorderRectangleWidth = 3;
this._BorderWidth = 1;
base._diagnosedHeight = (SystemInformation.CaptionHeight - 0x1a) / 2;
base.FormBorderStyle = FormBorderStyle.FixedDialog;
base.MaximizeBox = false;
FormEx.Style.StyleChanged += new EventHandler(this.XIMDialogStyle_StyleChanged);
base.Disposed += new EventHandler(this.XIMDialog_Disposed);
}
public XIMDialog(XFormStyle style) : base(false, style)
{
this._topBorderRectangle = Rectangle.Empty;
this._TopBorder = Rectangle.Empty;
this._leftBorderRectangle = Rectangle.Empty;
this._leftBorder = Rectangle.Empty;
this._rightBorderRectangle = Rectangle.Empty;
this._rightBorder = Rectangle.Empty;
this._bottomBorderRectangle = Rectangle.Empty;
this._bottomBorder = Rectangle.Empty;
this._UseBorder = true;
this._BorderRectangleHeight = 3;
this._BorderHeight = 1;
this._BorderRectangleWidth = 3;
this._BorderWidth = 1;
base.FormBorderStyle = FormBorderStyle.FixedDialog;
base.MaximizeBox = false;
base.Load += new EventHandler(this.XIMDialog_Load);
FormEx.Style.StyleChanged += new EventHandler(this.XIMDialogStyle_StyleChanged);
base.Disposed += new EventHandler(this.XIMDialog_Disposed);
}
public XIMDialog(FormBorderStyle borderStyle) : base(false, XFormStyle.Dialog)
{
this._topBorderRectangle = Rectangle.Empty;
this._TopBorder = Rectangle.Empty;
this._leftBorderRectangle = Rectangle.Empty;
this._leftBorder = Rectangle.Empty;
this._rightBorderRectangle = Rectangle.Empty;
this._rightBorder = Rectangle.Empty;
this._bottomBorderRectangle = Rectangle.Empty;
this._bottomBorder = Rectangle.Empty;
this._UseBorder = true;
this._BorderRectangleHeight = 3;
this._BorderHeight = 1;
this._BorderRectangleWidth = 3;
this._BorderWidth = 1;
base._diagnosedHeight = (SystemInformation.CaptionHeight - 0x1a) / 2;
base.FormBorderStyle = borderStyle;
base.MaximizeBox = false;
FormEx.Style.StyleChanged += new EventHandler(this.XIMDialogStyle_StyleChanged);
base.Disposed += new EventHandler(this.XIMDialog_Disposed);
}
protected override void ChangeSizeParemeter()
{
this.CreateTopBorder();
this.CreateRightBorder();
this.CreateBottomRegion();
this.CreateLeftRegion();
}
private void CreateBottomRegion()
{
if (this._UseBorder)
{
int y = this._bottom_rightfadeRegion.Top - this._BorderRectangleHeight;
this._bottomBorderRectangle = base.RectangToClientRect(new Rectangle(this._topBorderRectangle.Left + base._deltaX, y, this._topBorderRectangle.Width, this._BorderRectangleHeight), FormDirection.Bottom);
this._bottomBorder = base.RectangToClientRect(new Rectangle(this._TopBorder.Left + base._deltaX, y - this._BorderHeight, this._TopBorder.Width - this._BorderWidth, this._BorderHeight), FormDirection.Bottom);
}
else
{
int num2 = this._bottom_rightfadeRegion.Top - this._BorderRectangleHeight;
this._bottomBorderRectangle = base.RectangToClientRect(new Rectangle(this._topBorderRectangle.Left + base._deltaX, num2, this._topBorderRectangle.Width, this._BorderRectangleHeight), FormDirection.Bottom);
this._bottomBorder = Rectangle.Empty;
}
}
private void CreateLeftRegion()
{
if (this._UseBorder)
{
int x = this._topBorderRectangle.Left;
this._leftBorderRectangle = new Rectangle(x, this._rightBorderRectangle.Top, this._BorderRectangleWidth, this._rightBorderRectangle.Height);
this._leftBorder = new Rectangle(x + this._BorderRectangleWidth, this._rightBorder.Top, this._BorderWidth, this._rightBorder.Height - this._BorderHeight);
}
else
{
int left = this._topBorderRectangle.Left;
this._leftBorderRectangle = new Rectangle(left, this._rightBorderRectangle.Top, this._BorderRectangleWidth, this._rightBorderRectangle.Height);
this._leftBorder = Rectangle.Empty;
}
}
private void CreateRightBorder()
{
if (this._UseBorder)
{
int x = this._title_right_rgn.Right - this._BorderRectangleWidth;
this._rightBorderRectangle = new Rectangle(x, this._topBorderRectangle.Bottom, this._BorderRectangleWidth, ((this._bottom_rightfadeRegion.Top - this._topBorderRectangle.Bottom) - base._deltaY) - this._BorderRectangleHeight);
this._rightBorder = new Rectangle(this._rightBorderRectangle.Left - this._BorderWidth, this._TopBorder.Bottom, this._BorderWidth, this._rightBorderRectangle.Height - this._BorderHeight);
}
else
{
int num2 = this._title_right_rgn.Right - this._BorderRectangleWidth;
this._rightBorderRectangle = new Rectangle(num2, this._topBorderRectangle.Bottom, this._BorderRectangleWidth, ((this._bottom_rightfadeRegion.Top - this._topBorderRectangle.Bottom) - base._deltaY) - this._BorderRectangleHeight);
this._rightBorder = Rectangle.Empty;
}
}
private void CreateTopBorder()
{
if (this._UseBorder)
{
int y = this._title_left_rgn.Bottom;
if (base._extendCaption)
{
y = this._title_left_rgn_2.Bottom;
}
this._topBorderRectangle = new Rectangle(this._title_left_rgn.Left, y, (this._title_left_rgn.Width + this._titlebar_rgn.Width) + this._title_right_rgn.Width, this._BorderRectangleHeight);
this._TopBorder = new Rectangle(this._title_left_rgn.Left + this._BorderRectangleWidth, this._topBorderRectangle.Bottom, this._topBorderRectangle.Width - (this._BorderRectangleWidth * 2), this._BorderHeight);
}
else
{
int bottom = this._title_left_rgn.Bottom;
if (base._extendCaption)
{
bottom = this._title_left_rgn_2.Bottom;
}
this._topBorderRectangle = new Rectangle(this._title_left_rgn.Left, bottom, (this._title_left_rgn.Width + this._titlebar_rgn.Width) + this._title_right_rgn.Width, this._BorderRectangleHeight);
this._TopBorder = new Rectangle(this._title_left_rgn.Left, this._topBorderRectangle.Bottom, this._topBorderRectangle.Width, this._BorderHeight);
}
}
protected override void HandleBossKey()
{
if (base.Modal)
{
base.Close();
base.Dispose();
}
else if (BossKey.Hidden)
{
base.Visible = false;
}
else if (base.DialogResult == DialogResult.None)
{
base.Visible = true;
}
}
protected override void initComponentRegion()
{
if (base.IsHandleCreated)
{
base._button_interval = 9;
System.Drawing.Point empty = System.Drawing.Point.Empty;
int hemlineHeight = base.HemlineHeight;
Size size = base.Size;
if (!base.DesignMode && (base.Controls.get_Count() > 0))
{
Control control = base.Controls[0];
int num2 = base.IsVista ? 0 : 0;
size = new Size((control.Width + FormEx.Style.LeftBorderImage.Width) + FormEx.Style.RightBorderImage.Width, ((((num2 + control.Height) + FormEx.Style.TopBorderImage.Height) + FormEx.Style.Titlebar_Image.Height) + hemlineHeight) + FormEx.Style.BottomBorderImage.Height);
System.Drawing.Point point2 = new System.Drawing.Point(FormEx.Style.LeftBorderImage.Width, FormEx.Style.TopBorderImage.Height + FormEx.Style.Titlebar_Image.Height);
empty = new System.Drawing.Point(point2.X - control.Location.X, point2.Y - control.Location.Y);
control.Location = point2;
base.DisplaySize = size;
}
base.initComponentRegion();
if (!base.DesignMode)
{
for (int i = 1; i < base.Controls.get_Count(); i++)
{
Control control2 = base.Controls[i];
if (control2 != null)
{
System.Drawing.Point location = control2.Location;
location.Offset(empty);
control2.Location = location;
}
}
}
if (!base.DesignMode)
{
SortedList list = new SortedList();
for (int j = 1; j < base.Controls.get_Count(); j++)
{
Control control3 = base.Controls[j];
if ((control3 != null) && (control3 is XButton))
{
if ((control3.Anchor & AnchorStyles.Left) == AnchorStyles.Left)
{
list.Add(-control3.Location.X, control3);
}
int num5 = ((XButton) control3).ChangeSkin ? XButton.Style._backGroundBmp.Height : control3.Height;
System.Drawing.Point point4 = control3.Location;
point4.Y = (size.Height - num5) - (((hemlineHeight + FormEx.Style.BottomBorderImage.Height) - num5) / 2);
control3.Location = point4;
}
}
int x = size.Width - 10;
for (int k = 0; k < list.Count; k++)
{
Control byIndex = (Control) list.GetByIndex(k);
int width = XButton.Style.Background.Images[0].Width;
System.Drawing.Point point5 = byIndex.Location;
point5.X = (x - width) - 10;
x = point5.X;
byIndex.Location = point5;
}
}
this.CreateTopBorder();
this.CreateRightBorder();
this.CreateBottomRegion();
this.CreateLeftRegion();
}
}
protected override void PaintBorder(Graphics g, Rectangle clipedRect)
{
base.PaintBorder(g, clipedRect);
}
private void XIMDialog_Disposed(object sender, EventArgs e)
{
FormEx.Style.StyleChanged -= new EventHandler(this.XIMDialogStyle_StyleChanged);
}
private void XIMDialog_Load(object sender, EventArgs e)
{
this.initComponentRegion();
}
private void XIMDialogStyle_StyleChanged(object sender, EventArgs e)
{
base._firstAdjusted = true;
this.initComponentRegion();
}
protected int CaptionHeight
{
get
{
int captionHeight = SystemInformation.CaptionHeight;
if (base._extendCaption)
{
captionHeight = SystemInformation.CaptionHeight * 2;
}
return captionHeight;
}
}
public static XDialogStyle Style
{
get
{
return style;
}
set
{
style = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -