📄 formex.cs
字号:
if (!this._wndlessCtrlMgr.PointInRect(pt, this._titlebar_rgn, false))
{
return FormDirection.Normal;
}
FormDirection point = this._wndlessCtrlMgr.GetPoint(pt, nonClient);
if (point != FormDirection.None)
{
return point;
}
return FormDirection.TitleBar;
}
private Rectangle GetRestoreRectangle()
{
Imps.Client.Utils.Win32.WINDOWPLACEMENT lpwndpl = Imps.Client.Utils.Win32.WINDOWPLACEMENT.Default;
Imps.Client.Utils.Win32.NativeMethods.GetWindowPlacement(base.Handle, ref lpwndpl);
return new Rectangle(lpwndpl.rcNormalPosition.Left, lpwndpl.rcNormalPosition.Top, lpwndpl.rcNormalPosition.Width, lpwndpl.rcNormalPosition.Height);
}
protected virtual void HandleBossKey()
{
BossKey.HandleBossKeyEvent(this);
}
protected virtual void initComponentRegion()
{
base.SuspendLayout();
this.AdjustForm();
this.Region = this.CreateRegion(base.Width, base.Height, false);
if (this._firstAdjusted)
{
this._firstAdjusted = false;
}
base.ResumeLayout(true);
this._bRegionCreated = true;
if ((this.minButton != null) && this.minButton.CanAttachClick())
{
this.minButton.Click += new EventHandler(this.minButton_Click);
}
if ((this.maxButton != null) && this.maxButton.CanAttachClick())
{
this.maxButton.Click += new EventHandler(this.maxButton_Click);
}
if ((this.closeButton != null) && this.closeButton.CanAttachClick())
{
this.closeButton.Click += new EventHandler(this.closeButton_Click);
}
if ((this.restoreButton != null) && this.restoreButton.CanAttachClick())
{
this.restoreButton.Click += new EventHandler(this.restoreButton_Click);
}
this.SetPadding();
}
protected void InitializeComponent()
{
base.SuspendLayout();
base.set_AutoScaleDimensions(new SizeF(6f, 12f));
base.set_AutoScaleMode(1);
base.ClientSize = new Size(0x315, 0x295);
this.set_DoubleBuffered(true);
base.Name = "FormEx";
base.SizeGripStyle = SizeGripStyle.Hide;
base.ResumeLayout(false);
}
private bool IsNcBorder(InnerWin32.HitTest hitTestCode)
{
if (base.WindowState != FormWindowState.Maximized)
{
switch (hitTestCode)
{
case InnerWin32.HitTest.HTCAPTION:
case InnerWin32.HitTest.HTLEFT:
case InnerWin32.HitTest.HTRIGHT:
case InnerWin32.HitTest.HTTOP:
case InnerWin32.HitTest.HTTOPLEFT:
case InnerWin32.HitTest.HTTOPRIGHT:
case InnerWin32.HitTest.HTBOTTOM:
case InnerWin32.HitTest.HTBOTTOMLEFT:
case InnerWin32.HitTest.HTBOTTOMRIGHT:
return true;
}
}
return false;
}
private void maxButton_Click(object sender, EventArgs e)
{
this.doMax();
InnerWin32.SendMessage(base.Handle, 0x85, 1, 0);
}
private void minButton_Click(object sender, EventArgs e)
{
this.doMin();
}
protected override void OnActivated(EventArgs e)
{
this.bActived = true;
base.Invalidate();
base.OnActivated(e);
}
protected override void OnDeactivate(EventArgs e)
{
this.bActived = false;
base.Invalidate();
base.OnDeactivate(e);
}
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
base.Close();
}
base.OnKeyDown(e);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.RemoveCaption();
}
protected override void OnPaint(PaintEventArgs e)
{
if (((!base.DesignMode && base.IsHandleCreated) && !this._isdisposed) && (style.Top_leftfadeImage != null))
{
Graphics g = e.Graphics;
try
{
Rectangle clipedRect = e.ClipRectangle;
if (base.WindowState == FormWindowState.Normal)
{
this.PaintBorder(g, clipedRect);
this.PaintTitleBar(g, clipedRect);
this.PaintHemline(g, clipedRect);
this.PaintControlBoxBackground(g, clipedRect);
this.PaintButtons(g, clipedRect);
this.PaintDeactive(g, clipedRect);
}
else if (base.WindowState == FormWindowState.Maximized)
{
this.PaintTitleBar(g, clipedRect);
this.PaintHemline(g, clipedRect);
this.PaintControlBoxBackground(g, clipedRect);
this.PaintButtons(g, clipedRect);
this.PaintDeactive(g, clipedRect);
}
}
catch
{
}
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
if (base.DesignMode)
{
using (SolidBrush brush = new SolidBrush(Color.White))
{
e.Graphics.FillRectangle(brush, e.ClipRectangle);
return;
}
}
using (SolidBrush brush2 = new SolidBrush(this.FormBackColor))
{
e.Graphics.FillRectangle(brush2, e.ClipRectangle);
}
this.PaintBackground(e.Graphics, e.ClipRectangle);
}
protected override void OnResizeBegin(EventArgs e)
{
}
protected override void OnResizeEnd(EventArgs e)
{
}
protected virtual void PaintBackground(Graphics g, Rectangle clipedRect)
{
if (style.Back_TopFadeImage != null)
{
if (base.WindowState == FormWindowState.Maximized)
{
Rectangle rect = Rectangle.Empty;
rect = new Rectangle(0, 0, base.Width, style.Back_TopFadeImage.Height);
DrawHelper.DrawStrechImage(g, style.Back_TopFadeImage, rect);
rect = new Rectangle(0, base.ClientSize.Height - style.Back_BottomFadeImage.Height, base.Width, style.Back_BottomFadeImage.Height);
DrawHelper.DrawStrechImage(g, style.Back_BottomFadeImage, rect);
}
else
{
Rectangle empty = Rectangle.Empty;
empty = this.RectangToClientRect(new Rectangle(this._leftBorderRegion.Right, this._title_left_rgn.Bottom, (base.Width - this._leftBorderRegion.Width) - this._rightBorderRegion.Width, style.Back_TopFadeImage.Height), FormDirection.TopLeft);
DrawHelper.DrawStrechImage(g, style.Back_TopFadeImage, empty);
empty = this.RectangToClientRect(new Rectangle(this._leftBorderRegion.Right, this._hemline_bar_rgn.Top - style.Back_BottomFadeImage.Height, (base.Width - this._leftBorderRegion.Width) - this._rightBorderRegion.Width, style.Back_BottomFadeImage.Height), FormDirection.TopLeft);
DrawHelper.DrawStrechImage(g, style.Back_BottomFadeImage, empty);
}
}
}
protected virtual void PaintBorder(Graphics g, Rectangle clipedRect)
{
if (style.ToprightImage != null)
{
Rectangle rect = Rectangle.Empty;
rect = this.RectangToClientRect(new Rectangle(this._leftBorderRegion.Left, this._topBorderRegion.Top, style.TopleftImage.Width, style.TopleftImage.Height), FormDirection.TopLeft);
g.DrawImage(style.TopleftImage, rect);
rect = this.RectangToClientRect(new Rectangle(this._right_topfadeRegion.Left, this._topBorderRegion.Top, style.ToprightImage.Width, style.ToprightImage.Height), FormDirection.TopRight);
g.DrawImage(style.ToprightImage, rect);
rect = this.RectangToClientRect(new Rectangle(this._leftBorderRegion.Left, this._bottomBorderRegion.Top, style.BottomleftImage.Width, style.BottomleftImage.Height), FormDirection.TopRight);
g.DrawImage(style.BottomleftImage, rect);
rect = this.RectangToClientRect(new Rectangle(this._right_topfadeRegion.Left, this._bottomBorderRegion.Top, style.BottomrightImage.Width, style.BottomrightImage.Height), FormDirection.TopRight);
g.DrawImage(style.BottomrightImage, rect);
rect = this.RectangToClientRect(this._top_leftfadeRegion, FormDirection.TopRight);
g.DrawImage(style.Top_leftfadeImage, rect);
rect = this.RectangToClientRect(this._topBorderRegion, FormDirection.TopRight);
DrawHelper.DrawStrechImage(g, style.TopBorderImage, rect);
rect = this.RectangToClientRect(this._top_rightfadeRegion, FormDirection.TopRight);
g.DrawImage(style.Top_rightfadeImage, rect);
rect = this.RectangToClientRect(this._right_topfadeRegion, FormDirection.TopRight);
DrawHelper.DrawVerStrechImage(g, style.Right_topfadeImage, rect, true);
rect = this.RectangToClientRect(this._rightBorderRegion, FormDirection.TopRight);
DrawHelper.DrawVerStrechImage(g, style.RightBorderImage, rect, true);
rect = this.RectangToClientRect(this._right_bottomfadeRegion, FormDirection.TopRight);
DrawHelper.DrawVerStrechImage(g, style.Right_bottomfadeImage, rect, true);
if (this.HemlineStyle == Imps.Client.Pc.BizControls.HemlineStyle.None)
{
rect = this.RectangToClientRect(this._bottom_rightfadeRegion, FormDirection.TopRight);
if (style.Bottom_rightfadeImage2 != null)
{
DrawHelper.DrawStrechImage(g, style.Bottom_rightfadeImage2, rect, true);
}
else
{
DrawHelper.DrawStrechImage(g, style.Bottom_rightfadeImage, rect, true);
}
rect = this.RectangToClientRect(this._bottomBorderRegion, FormDirection.TopRight);
if (style.BottomBorderImage2 != null)
{
DrawHelper.DrawStrechImage(g, style.BottomBorderImage2, rect, true);
}
else
{
DrawHelper.DrawStrechImage(g, style.BottomBorderImage, rect, true);
}
rect = this.RectangToClientRect(this._bottom_leftfadeRegion, FormDirection.TopRight);
if (style.Bottom_leftfadeImage2 != null)
{
DrawHelper.DrawStrechImage(g, style.Bottom_leftfadeImage2, rect, true);
}
else
{
DrawHelper.DrawStrechImage(g, style.Bottom_leftfadeImage, rect, true);
}
}
else
{
rect = this.RectangToClientRect(this._bottom_rightfadeRegion, FormDirection.TopRight);
DrawHelper.DrawStrechImage(g, style.Bottom_rightfadeImage, rect, true);
rect = this.RectangToClientRect(this._bottomBorderRegion, FormDirection.TopRight);
DrawHelper.DrawStrechImage(g, style.BottomBorderImage, rect, true);
rect = this.RectangToClientRect(this._bottom_leftfadeRegion, FormDirection.TopRight);
DrawHelper.DrawStrechImage(g, style.Bottom_leftfadeImage, rect, true);
}
rect = this.RectangToClientRect(this._left_bottomfadeRegion, FormDirection.TopRight);
DrawHelper.DrawVerStrechImage(g, style.Left_bottomfadeImage, rect);
rect = this.RectangToClientRect(this._leftBorderRegion, FormDirection.TopRight);
DrawHelper.DrawVerStrechImage(g, style.LeftBorderImage, rect);
rect = this.RectangToClientRect(this._left_topfadeRegion, FormDirection.TopRight);
DrawHelper.DrawVerStrechImage(g, style.Left_topfadeImage, rect);
}
}
protected virtual void PaintButtons(Graphics g, Rectangle clipRect)
{
this._wndlessCtrlMgr.OnPaint(g, c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -