📄 formex.cs
字号:
{
this._captionLabel = new XFormWndlessLabel(this.Text, this.SupportCationLink);
this._captionLabel.Location = new System.Drawing.Point(buttonX, buttonTop);
this._captionLabel.ClientSize = new Size(captionLabelRight - buttonX, this.TitleHeight - buttonTop);
this._captionLabel.MenuStrip = this.CreateSystemMenuStrip();
this._captionLabel.HitTestCode = FormDirection.TitleBar;
this._captionLabel.TextFont = SystemFonts.get_CaptionFont();
this._captionLabel.ForeColor = Color.White;
this._captionLabel.DoubleClick += new EventHandler(this._captionLabel_DoubleClick);
this._wndlessCtrlMgr.Controls.Add(this._captionLabel);
}
else
{
this._captionLabel.Location = new System.Drawing.Point(buttonX, buttonTop);
this._captionLabel.ClientSize = new Size(captionLabelRight - buttonX, this.TitleHeight - buttonTop);
this._captionLabel.MenuStrip = this._systemMenuStrip;
}
this._captionLabel.Name = "Caption";
this._captionLabel.NonClientArea = nonClient;
this._iconImage.Location = new System.Drawing.Point(this._iconImage.Left, (int) ((((float) (this._captionLabel.Top + this._captionLabel.Bottom)) / 2f) - (((float) this._iconImage.Height) / 2f)));
}
private void CreateCloseButtonRegion(int buttonTop, int buttonX, int iImageWidth, int iHeight, bool nonClinet)
{
if (Style.CloseX != 0)
{
iImageWidth = Style.CloseButtonImage.Width / 3;
iHeight = Style.CloseButtonImage.Height;
buttonTop = Style.CloseY;
buttonX = (this._rightBorderRegion.Right - Style.CloseX) - this._deltaX;
}
if (this.closeButton == null)
{
this.closeButton = new WndlessBoxButton(style.CloseButtonImage, 3, 1);
this.closeButton.Location = new System.Drawing.Point(buttonX, buttonTop);
this.closeButton.ClientSize = new Size(iImageWidth, iHeight);
this.closeButton.ToolTipText = "关闭";
this.closeButton.HitTestCode = FormDirection.CloseBox;
this._wndlessCtrlMgr.Controls.Add(this.closeButton);
}
else
{
this.closeButton.Location = new System.Drawing.Point(buttonX, buttonTop);
this.closeButton.ClientSize = new Size(iImageWidth, iHeight);
}
this.closeButton.Name = "CloseButton";
this.closeButton.NonClientArea = nonClinet;
}
private void CreateControlBoxRegion(int buttonX, int buttonY)
{
if (Style.ControlBox_Image == null)
{
if (Style.MinButtonImage != null)
{
this._controlBoxRect = Rectangle.FromLTRB((this._rightBorderRegion.Right - Style.MinX) - this._deltaX, Style.MinY, this._rightBorderRegion.Left, Style.MinY + Style.MinButtonImage.Height);
}
}
else
{
this._controlBoxRect = new Rectangle(((this._rightBorderRegion.Right - Style.ControlBoxX) - this._deltaX) - Style.ControlBox_Image.Width, Style.ControlBoxY, Style.ControlBox_Image.Width, Style.ControlBox_Image.Height / 3);
}
}
private void CreateEditableCaptionRegion(int buttonTop, int buttonX, int captionLabelRight, bool nonClient)
{
}
protected virtual void CreateExtendControl()
{
}
private void CreateIconRegion(int buttonTop, int buttonX, bool nonClient)
{
if (Style.IconX != 0)
{
buttonX = Style.IconX;
buttonTop = Style.IconY;
}
if (this._iconImage == null)
{
this._iconImage = new formCaptionIcon();
this._iconImage.Location = new System.Drawing.Point(buttonX, buttonTop);
this._iconImage.MenuStrip = this.CreateSystemMenuStrip();
this._iconImage.HitTestCode = FormDirection.Caption;
this._iconImage.DoubleClick += new EventHandler(this._iconImage_DoubleClick);
this._iconImage.Visible = base.get_ShowIcon();
this._iconImage.Image = ImpsIcons.LogoPng;
this._iconImage.ClientSize = new Size(this._iconImage.Image.Width, this._iconImage.Image.Height);
this._wndlessCtrlMgr.Controls.Add(this._iconImage);
base.Icon = ImpsIcons.Logo;
}
else
{
this._iconImage.Location = new System.Drawing.Point(buttonX, buttonTop);
this._iconImage.ClientSize = new Size(this._iconImage.Image.Width, this._iconImage.Image.Height);
this._iconImage.MenuStrip = this._systemMenuStrip;
}
this._iconImage.Name = "Icon";
this._iconImage.NonClientArea = nonClient;
}
protected System.Drawing.Region CreateMaximized()
{
this.CreateRegion(base.Width, base.Height, false);
if (this._resizer != null)
{
this._resizer.Visible = false;
}
this.CreateMaximizedExtendControl();
base.Invalidate();
return null;
}
private void CreateMaximizedBoxRegion(int buttonTop, int buttonX, int iImageWidth, int iHeight, bool nonClient)
{
if (Style.MaxX != 0)
{
iImageWidth = Style.MaxButtonImage.Width / 3;
iHeight = Style.MaxButtonImage.Height;
buttonTop = Style.MaxY;
buttonX = (this._rightBorderRegion.Right - Style.MaxX) - this._deltaX;
}
if (this.maxButton == null)
{
this.maxButton = new WndlessBoxButton(style.MaxButtonImage, 3, 1);
this.maxButton.Location = new System.Drawing.Point(buttonX, buttonTop);
this.maxButton.ClientSize = new Size(iImageWidth, iHeight);
this.maxButton.ToolTipText = "最大化";
this.maxButton.HitTestCode = FormDirection.MaxBox;
this._wndlessCtrlMgr.Controls.Add(this.maxButton);
}
else
{
this.maxButton.Location = new System.Drawing.Point(buttonX, buttonTop);
this.maxButton.ClientSize = new Size(iImageWidth, iHeight);
}
this.maxButton.Name = "MaxButton";
this.maxButton.NonClientArea = nonClient;
}
protected virtual void CreateMaximizedExtendControl()
{
}
private void CreateMenuBarRegion()
{
this.CreateMenuBarRegion(false);
}
private void CreateMenuBarRegion(bool maximized)
{
if (maximized && !this._extendCaption)
{
new Rectangle(0, 0, base.Width, 0);
}
}
private void CreateMinimizedBoxRegion(int buttonTop, int buttonX, int iImageWidth, int iHeight, bool nonClient)
{
if (base.MaximizeBox)
{
if (Style.MinX != 0)
{
buttonTop = Style.MinY;
iImageWidth = Style.MinButtonImage.Width / 3;
iHeight = Style.MinButtonImage.Height;
buttonX = (this._rightBorderRegion.Right - Style.MinX) - this._deltaX;
}
}
else if (Style.MaxX != 0)
{
buttonTop = Style.MaxY;
buttonX = (this._rightBorderRegion.Right - Style.MaxX) - this._deltaX;
iImageWidth = Style.MinButtonImage.Width / 3;
iHeight = Style.MinButtonImage.Height;
}
if (this.minButton == null)
{
this.minButton = new WndlessBoxButton(style.MinButtonImage, 3, 1);
this.minButton.Location = new System.Drawing.Point(buttonX, buttonTop);
this.minButton.ClientSize = new Size(iImageWidth, iHeight);
this.minButton.ToolTipText = "最小化";
this._wndlessCtrlMgr.Controls.Add(this.minButton);
this.minButton.HitTestCode = FormDirection.MinBox;
}
else
{
this.minButton.Location = new System.Drawing.Point(buttonX, buttonTop);
this.minButton.ClientSize = new Size(iImageWidth, iHeight);
}
this.minButton.Name = "MiniButton";
this.minButton.NonClientArea = nonClient;
}
protected System.Drawing.Region CreateRegion(int nWidth, int nHeight, bool bReSize)
{
System.Drawing.Region region2;
System.Drawing.Region region3;
System.Drawing.Region region4;
System.Drawing.Region region5;
System.Drawing.Region region6;
System.Drawing.Region region7;
System.Drawing.Region region8;
System.Drawing.Region region10;
if (base.DesignMode)
{
return null;
}
int x = 4;
int y = 4;
this._title_left_rgn = new Rectangle(x, y, 0x83, this.TitleHeight - 4);
x += 0x83;
this._titlebar_rgn = new Rectangle(x, y, (((base.Width - 4) - 4) - 0x83) - 0x6c, this.TitleHeight - 4);
x += this._titlebar_rgn.Width;
this._title_right_rgn = new Rectangle(x, y, 0x6c, this.TitleHeight - 4);
this._title_rgn = Rectangle.Union(this._title_left_rgn, this._titlebar_rgn);
this._title_rgn = Rectangle.Union(this._title_rgn, this._title_right_rgn);
x = 4;
y = 0;
this._top_leftfadeRegion = new Rectangle(x, y, 0x83, 4);
x += 0x83;
this._topBorderRegion = new Rectangle(x, y, (((base.Width - 4) - 4) - 0x83) - 0x6c, 4);
x += this._topBorderRegion.Width;
this._top_rightfadeRegion = new Rectangle(x, y, 0x6c, 4);
y = base.Height - 4;
x = 4;
this._bottom_leftfadeRegion = new Rectangle(x, y, 0x83, 4);
x += 0x83;
this._bottomBorderRegion = new Rectangle(x, y, (((base.Width - 4) - 4) - 0x83) - 0x6c, 4);
x += this._bottomBorderRegion.Width;
this._bottom_rightfadeRegion = new Rectangle(x, y, 0x6c, 4);
y = 4;
x = base.Width - 4;
this._right_topfadeRegion = new Rectangle(x, y, 4, 0x3a);
y += 0x3a;
this._rightBorderRegion = new Rectangle(x, y, 4, (((base.Height - 4) - 4) - 0x3a) - 0x5b);
y += this._rightBorderRegion.Height;
this._right_bottomfadeRegion = new Rectangle(x, y, 4, 0x5b);
x = 0;
y = 4;
this._left_topfadeRegion = new Rectangle(x, y, 4, 0x3a);
y += 0x3a;
this._leftBorderRegion = new Rectangle(x, y, 4, (((base.Height - 4) - 4) - 0x3a) - 0x5b);
y += this._leftBorderRegion.Height;
this._left_bottomfadeRegion = new Rectangle(x, y, 4, 0x5b);
y = (base.Height - 4) - this.HemlineHeight;
x = 4;
this._hemline_left_rgn = new Rectangle(x, y, 0x83, this.HemlineHeight);
x += 0x83;
this._hemline_bar_rgn = new Rectangle(x, y, (((base.Width - 4) - 4) - 0x83) - 0x6c, this.HemlineHeight);
x += this._hemline_bar_rgn.Width;
this._hemline_right_rgn = new Rectangle(x, y, 0x6c, this.HemlineHeight);
int buttonY = this._title_rgn.Top + 3;
int buttonX = (this._title_rgn.Right - 4) - (this.BorderSize.Width * 2);
int iImageWidth = _systemMenuButtonImageSize.Width;
int iHeight = _systemMenuButtonImageSize.Height;
buttonX -= this._button_interval + 3;
this.CreateControlBoxRegion(buttonX, buttonY);
this.CreateCloseButtonRegion(buttonY, buttonX, iImageWidth, iHeight, false);
if (base.MaximizeBox)
{
buttonX -= iImageWidth + this._interval;
this.CreateMaximizedBoxRegion(buttonY, buttonX, iImageWidth, iHeight, false);
this.CreateRestoreBoxRegion(buttonY, buttonX, iImageWidth, iHeight, false);
if (base.WindowState == FormWindowState.Maximized)
{
this.maxButton.Visible = false;
this.restoreButton.Visible = true;
}
else
{
this.maxButton.Visible = true;
this.restoreButton.Visible = false;
}
}
if (base.MinimizeBox)
{
buttonX -= iImageWidth + this._interval;
this.CreateMinimizedBoxRegion(buttonY, buttonX, iImageWidth, iHeight, false);
}
int captionLabelRight = buttonX;
buttonY = 6;
buttonX = this._leftBorderRegion.Right;
this.CreateIconRegion(buttonY, buttonX, false);
buttonY += 2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -