📄 eform.cs
字号:
base.OnMouseUp(e);
this.ElementMgr.OnMouseUp(e);
}
protected override void OnPaint(PaintEventArgs e)
{
if (!base.DesignMode)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.DrawImage(this.BackBufferBitmap, 0, 0);
if (this._dynamicElements.Visible)
{
this._dynamicElements.OnPaint(e);
}
if (this.ElementMgr.Visible)
{
this.ElementMgr.OnPaint(e);
}
this.PaintDeactive(g);
}
}
private void PaintDeactive(Graphics g)
{
if (!this.bActived && (this.Style._titleHeight > 0))
{
using (Bitmap image = new Bitmap(base.Width, this.Style._titleHeight))
{
Graphics.FromImage(image).FillRectangle(new SolidBrush(Color.Black), 0, 0, image.Width, image.Height);
ImageAttributes imageAttr = new ImageAttributes();
ColorMatrix newColorMatrix = new ColorMatrix();
newColorMatrix.Matrix00 = 1f;
newColorMatrix.Matrix11 = 1f;
newColorMatrix.Matrix22 = 1f;
newColorMatrix.Matrix33 = 0.2f;
newColorMatrix.Matrix44 = 1f;
imageAttr.SetColorMatrix(newColorMatrix);
Rectangle destRect = new Rectangle(0, 0, image.Width, image.Height);
g.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttr);
}
}
}
protected void RemoveCaption()
{
int num = Imps.Client.Utils.Win32.NativeMethods.GetWindowLong(base.Handle, -16) & -12582913;
Imps.Client.Utils.Win32.NativeMethods.SetWindowLong(base.Handle, -16, (IntPtr) num);
}
public virtual void Reset()
{
}
protected virtual void SetStyle(XmlElement elem)
{
}
public virtual void SetTheme(XmlElement elem)
{
foreach (XmlNode node in elem.ChildNodes)
{
XmlElement element = node as XmlElement;
if (element != null)
{
if (element.Name == "Form")
{
this.Style.SetStyle(element);
continue;
}
if (element.Name == "Button")
{
string name = element.GetAttribute("id");
Element element2 = this.ElementMgr.Controls.Search(name);
if (element2 != null)
{
element2._style.SetStyle(element);
}
else
{
ElementButton control = new ElementButton();
control.Style.SetStyle(element);
this.ElementMgr.Controls.Add(control);
}
continue;
}
if (element.Name == "Panel")
{
string attribute = element.GetAttribute("id");
Element element3 = this.ElementMgr.Controls.Search(attribute);
if (element3 != null)
{
element3._style.SetStyle(element);
}
else
{
ElementPanel panel = new ElementPanel();
panel.Style.SetStyle(element);
this._dynamicElements.Controls.AddHead(panel);
}
continue;
}
if (element.Name == "Static")
{
ElementStatic @static = new ElementStatic();
@static.Style.SetStyle(element);
this._dynamicElements.Controls.AddHead(@static);
continue;
}
this.SetStyle(element);
}
}
}
private void style_StyleChanged(object sender, EventArgs e)
{
this.set_MinimumSize(new Size(this.Style._minWidth, this.Style._minHeight));
this.set_MaximumSize(new Size(this.Style._maxWidth, this.Style._maxHeight));
Graphics g = Graphics.FromImage(this.BackBufferBitmap);
this.DrawBackground(g);
base.Invalidate();
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == 0x47)
{
this._inPosChanged = true;
base.WndProc(ref m);
this._inPosChanged = false;
}
else if ((m.Msg != 0x85) && (m.Msg != 0x83))
{
if (m.Msg == 0x86)
{
m.Result = (IntPtr) 1;
}
else
{
if (m.Msg == 0x84)
{
m.Result = new IntPtr(1);
System.Drawing.Point pt = base.PointToClient(new System.Drawing.Point((int) m.LParam));
if (this.ElementMgr.MouseOnElement(pt))
{
return;
}
this.ElementMgr.OnMouseMove(new MouseEventArgs(MouseButtons.None, 0, pt.X, pt.Y, 0));
if (ElementsManager.PointInRect(pt, this.ResizeCorner))
{
m.Result = new IntPtr(0x11);
return;
}
int x = pt.X;
int y = pt.Y;
if (y < 4)
{
m.Result = new IntPtr(12);
return;
}
if (y > (base.Height - 4))
{
m.Result = new IntPtr(15);
return;
}
if (x < 4)
{
m.Result = new IntPtr(10);
return;
}
if (x > (base.Width - 4))
{
m.Result = new IntPtr(11);
return;
}
if (y < this.Style._titleHeight)
{
m.Result = new IntPtr(2);
return;
}
}
else if (m.Msg == 0xa3)
{
return;
}
base.WndProc(ref m);
}
}
}
public Bitmap BackBufferBitmap
{
get
{
return this._backbuffer_bitmap;
}
set
{
if (this.BackBufferBitmap != null)
{
this.BackBufferBitmap.Dispose();
}
this._backbuffer_bitmap = value;
}
}
protected override System.Windows.Forms.CreateParams CreateParams
{
get
{
if (this._inPosChanged)
{
System.Windows.Forms.CreateParams createParams = base.CreateParams;
createParams.Style &= -13369345;
createParams.ExStyle &= -257;
return createParams;
}
return base.CreateParams;
}
}
public ElementsManager DynamicElementsMgr
{
get
{
return this._dynamicElements;
}
}
public ElementsManager ElementMgr
{
get
{
return this._elementmgr;
}
}
private Rectangle ResizeCorner
{
get
{
if (this.Style._resize != null)
{
int width = this.Style._resize.Width;
int height = this.Style._resize.Height;
return new Rectangle(base.Width - width, base.Height - height, width, height);
}
return new Rectangle(0, 0, 0, 0);
}
}
public EFormStyle Style
{
get
{
return this._style;
}
set
{
this._style = value;
}
}
public Region WndRegion
{
get
{
return base.Region;
}
set
{
if (this.WndRegion != null)
{
this.WndRegion.Dispose();
}
base.Region = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -