项目初始化后续改动

This commit is contained in:
wule committed 2026-06-12 10:41:13 +08:00
1 parent 40c702883c
commit 42acf1b1cb
67 files changed
+5794 -1762

No files matched your search

+177
View File
@@ -0,0 +1,177 @@
namespace Work.BaseForms
{
partial class BaseGeneralForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pnlTitle = new System.Windows.Forms.Panel();
this.pbMinBase = new System.Windows.Forms.PictureBox();
this.pbNormalBase = new System.Windows.Forms.PictureBox();
this.pbMaxBase = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.lbTitle = new System.Windows.Forms.Label();
this.pbCloseBase = new System.Windows.Forms.PictureBox();
this.pnlTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbMinBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbNormalBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbMaxBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
this.SuspendLayout();
//
// panel2
//
this.pnlTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.pnlTitle.Controls.Add(this.pbMinBase);
this.pnlTitle.Controls.Add(this.pbNormalBase);
this.pnlTitle.Controls.Add(this.pbMaxBase);
this.pnlTitle.Controls.Add(this.pictureBox3);
this.pnlTitle.Controls.Add(this.lbTitle);
this.pnlTitle.Controls.Add(this.pbCloseBase);
this.pnlTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTitle.Location = new System.Drawing.Point(0, 0);
this.pnlTitle.Name = "panel2";
this.pnlTitle.Size = new System.Drawing.Size(386, 32);
this.pnlTitle.TabIndex = 2;
this.pnlTitle.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown);
this.pnlTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove);
//
// pbMinBase
//
this.pbMinBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbMinBase.Image = global::Work.Properties.Resources.min;
this.pbMinBase.Location = new System.Drawing.Point(258, 0);
this.pbMinBase.Name = "pbMinBase";
this.pbMinBase.Size = new System.Drawing.Size(32, 32);
this.pbMinBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbMinBase.TabIndex = 1;
this.pbMinBase.TabStop = false;
this.pbMinBase.Click += new System.EventHandler(this.PictureBox2_Click);
this.pbMinBase.MouseLeave += new System.EventHandler(this.PictureBox2_MouseLeave);
this.pbMinBase.MouseHover += new System.EventHandler(this.PictureBox2_MouseHover);
//
// pbNormalBase
//
this.pbNormalBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbNormalBase.Image = global::Work.Properties.Resources.normal;
this.pbNormalBase.Location = new System.Drawing.Point(290, 0);
this.pbNormalBase.Name = "pbNormalBase";
this.pbNormalBase.Size = new System.Drawing.Size(32, 32);
this.pbNormalBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbNormalBase.TabIndex = 6;
this.pbNormalBase.TabStop = false;
this.pbNormalBase.Visible = false;
this.pbNormalBase.Click += new System.EventHandler(this.pbNormalBase_Click);
this.pbNormalBase.MouseLeave += new System.EventHandler(this.pbNormalBase_MouseLeave);
this.pbNormalBase.MouseHover += new System.EventHandler(this.pbNormalBase_MouseHover);
//
// pbMaxBase
//
this.pbMaxBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbMaxBase.Image = global::Work.Properties.Resources.max;
this.pbMaxBase.Location = new System.Drawing.Point(322, 0);
this.pbMaxBase.Name = "pbMaxBase";
this.pbMaxBase.Size = new System.Drawing.Size(32, 32);
this.pbMaxBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbMaxBase.TabIndex = 5;
this.pbMaxBase.TabStop = false;
this.pbMaxBase.Visible = false;
this.pbMaxBase.Click += new System.EventHandler(this.pbMaxBase_Click);
this.pbMaxBase.MouseLeave += new System.EventHandler(this.pbMaxBase_MouseLeave);
this.pbMaxBase.MouseHover += new System.EventHandler(this.pbMaxBase_MouseHover);
//
// pictureBox3
//
this.pictureBox3.BackColor = System.Drawing.Color.Transparent;
this.pictureBox3.Image = global::Work.Properties.Resources.icon;
this.pictureBox3.Location = new System.Drawing.Point(5, 3);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(23, 23);
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox3.TabIndex = 3;
this.pictureBox3.TabStop = false;
//
// lbTitle
//
this.lbTitle.AutoSize = true;
this.lbTitle.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lbTitle.ForeColor = System.Drawing.Color.White;
this.lbTitle.Location = new System.Drawing.Point(31, 6);
this.lbTitle.Name = "lbTitle";
this.lbTitle.Size = new System.Drawing.Size(45, 17);
this.lbTitle.TabIndex = 2;
this.lbTitle.Text = "label1";
//
// pbCloseBase
//
this.pbCloseBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbCloseBase.Image = global::Work.Properties.Resources.close;
this.pbCloseBase.Location = new System.Drawing.Point(354, 0);
this.pbCloseBase.Name = "pbCloseBase";
this.pbCloseBase.Size = new System.Drawing.Size(32, 32);
this.pbCloseBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbCloseBase.TabIndex = 0;
this.pbCloseBase.TabStop = false;
this.pbCloseBase.Click += new System.EventHandler(this.PictureBox1_Click);
this.pbCloseBase.MouseLeave += new System.EventHandler(this.PictureBox1_MouseLeave);
this.pbCloseBase.MouseHover += new System.EventHandler(this.PictureBox1_MouseHover);
//
// BaseGeneralForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.ClientSize = new System.Drawing.Size(386, 232);
this.Controls.Add(this.pnlTitle);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "BaseGeneralForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "BaseForm";
this.Load += new System.EventHandler(this.LcBaseForm_Load);
this.pnlTitle.ResumeLayout(false);
this.pnlTitle.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbMinBase)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbNormalBase)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbMaxBase)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel pnlTitle;
private System.Windows.Forms.PictureBox pbMinBase;
private System.Windows.Forms.PictureBox pbNormalBase;
private System.Windows.Forms.PictureBox pbMaxBase;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.Label lbTitle;
protected System.Windows.Forms.PictureBox pbCloseBase;
}
}
+295
View File
@@ -0,0 +1,295 @@
using AllBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Work.BaseForms
{
public partial class BaseGeneralForm : Form
{
const int WM_NCHITTEST = 0x0084;
const int HTLEFT = 10; //左边界
const int HTRIGHT = 11; //右边界
const int HTTOP = 12; //上边界
const int HTTOPLEFT = 13; //左上角
const int HTTOPRIGHT = 14; //右上角
const int HTBOTTOM = 15; //下边界
const int HTBOTTOMLEFT = 0x10; //左下角
const int HTBOTTOMRIGHT = 17; //右下角
protected bool Minimized { get { return this.pbMinBase.Visible; } set { this.pbMinBase.Visible = value; } }
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
Point vPoint = new Point((int)m.LParam & 0xFFFF,
(int)m.LParam >> 16 & 0xFFFF);
vPoint = PointToClient(vPoint);
if (vPoint.X <= 5)
if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOPLEFT;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOMLEFT;
else m.Result = (IntPtr)HTLEFT;
else if (vPoint.X >= ClientSize.Width - 5)
if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOPRIGHT;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOMRIGHT;
else m.Result = (IntPtr)HTRIGHT;
else if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOP;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOM;
break;
default:
base.WndProc(ref m);
break;
}
}
public BaseGeneralForm()
{
InitializeComponent();
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
if (FileBase.Exists(BaseClass.ProgromLogoIco))
{
Image img = Image.FromFile(BaseClass.ProgromLogoIco);
pictureBox3.Image = img;
}
}
private void LcBaseForm_Load(object sender, EventArgs e)
{
if (BaseClass.Ico != null)
Iconx = Icon = BaseClass.Ico;
else
Iconx = Icon = BaseClass.Ico = ImageBuild.ConvertToIcon(Properties.Resources.icon);
if (this.IsShowMax)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = true;
}
else
{
this.pbMaxBase.Visible = true;
this.pbNormalBase.Visible = false;
}
}
SetPanelVisible(this.TopLevel || DesignMode);
}
public void SetPanelVisible(bool visible)
{
if (visible)
{
this.Padding = new Padding(1);
this.pnlTitle.Visible = true;
}
else
{
this.Padding = new Padding(0);
this.pnlTitle.Visible = false;
}
}
private void PictureBox2_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
public virtual void PictureBox1_Click(object sender, EventArgs e)
{
//pictureBox3.Image?.Dispose();
Close();
}
private Icon _iconx;
public Icon Iconx
{
set
{
_iconx = value;
if (_iconx == null) return;
using (MemoryStream mStream = new MemoryStream())
{
_iconx.Save(mStream);
Image image = Image.FromStream(mStream);
pictureBox3.Image = image;
}
}
}
private bool isShowMax = false;
public bool IsShowMax
{
get { return isShowMax; }
set
{
isShowMax = value;
if (isShowMax)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = true;
}
else
{
this.pbMaxBase.Visible = true;
this.pbNormalBase.Visible = false;
}
}
else
{
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = false;
}
}
}
public string TitleText
{
get
{
return Text;
}
set
{
Text = lbTitle.Text = value;
}
}
private Point mouseOffset;//记录鼠标指针的坐标
private bool isMouseDown;//记录鼠标左键是否按下
private void Panel1_MouseMove(object sender, MouseEventArgs e)
{
if (isMouseDown)
{//获取鼠标的位置
Point mousePos = MousePosition;
mousePos.Offset(mouseOffset.X, mouseOffset.Y);
Location = mousePos;
}
}
private void Panel1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mouseOffset = new Point(-e.X, -e.Y);
isMouseDown = true;
}
}
private void Panel1_MouseUp(object sender, MouseEventArgs e)
{
isMouseDown = false;
}
private void PictureBox1_MouseHover(object sender, EventArgs e)
{
this.pbCloseBase.Image = global::Work.Properties.Resources.close_hover;
this.Cursor = Cursors.Hand;
}
private void PictureBox1_MouseLeave(object sender, EventArgs e)
{
this.pbCloseBase.Image = global::Work.Properties.Resources.close;
this.Cursor = Cursors.Default;
}
private void PictureBox2_MouseHover(object sender, EventArgs e)
{
this.pbMinBase.Image = global::Work.Properties.Resources.min_hover;
this.Cursor = Cursors.Hand;
}
private void PictureBox2_MouseLeave(object sender, EventArgs e)
{
this.pbMinBase.Image = global::Work.Properties.Resources.min;
this.Cursor = Cursors.Default;
}
public virtual void HideTitle()
{
// this.panel1.Visible = false;
}
#region 窗体提交数据完成事件
public event Action<object> SaveComplete;
protected virtual void OnSaveComplete(object param)
{
this.SaveComplete?.Invoke(param);
}
#endregion
private void pbNormalBase_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Normal;
this.pbMaxBase.Visible = true;
this.pbNormalBase.Visible = false;
}
private void pbNormalBase_MouseHover(object sender, EventArgs e)
{
this.pbNormalBase.Image = global::Work.Properties.Resources.normal_hover;
this.Cursor = Cursors.Hand;
}
private void pbNormalBase_MouseLeave(object sender, EventArgs e)
{
this.pbNormalBase.Image = global::Work.Properties.Resources.normal;
this.Cursor = Cursors.Default;
}
private void pbMaxBase_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Maximized;
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = true;
}
private void pbMaxBase_MouseHover(object sender, EventArgs e)
{
this.pbMaxBase.Image = global::Work.Properties.Resources.max_hover;
this.Cursor = Cursors.Hand;
}
private void pbMaxBase_MouseLeave(object sender, EventArgs e)
{
this.pbMaxBase.Image = global::Work.Properties.Resources.max;
this.Cursor = Cursors.Default;
}
private Point mPoint;
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
mPoint = new Point(e.X, e.Y);
}
private void panel2_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Location = new Point(this.Location.X + e.X - mPoint.X, this.Location.Y + e.Y - mPoint.Y);
}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+1 -1
View File
@@ -11,7 +11,7 @@ using System.Windows.Forms;
namespace Work.BaseForms
{
public partial class BaseMsgForm : BaseForm
public partial class BaseMsgForm : BaseGeneralForm
{
public BaseMsgForm()
{