29Wx状态初始化

This commit is contained in:
wule committed 2026-06-11 15:17:50 +08:00
1 parent 9fd5579fcd
commit 40c702883c
322 files changed
+155553

No files matched your search

+177
View File
@@ -0,0 +1,177 @@
namespace Work.BaseForms
{
partial class BaseForm
{
/// <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.panel2 = 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.panel2.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.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.panel2.Controls.Add(this.pbMinBase);
this.panel2.Controls.Add(this.pbNormalBase);
this.panel2.Controls.Add(this.pbMaxBase);
this.panel2.Controls.Add(this.pictureBox3);
this.panel2.Controls.Add(this.lbTitle);
this.panel2.Controls.Add(this.pbCloseBase);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(386, 32);
this.panel2.TabIndex = 2;
this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown);
this.panel2.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);
//
// BaseForm
//
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, 183);
this.Controls.Add(this.panel2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "BaseForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "BaseForm";
this.Load += new System.EventHandler(this.LcBaseForm_Load);
this.panel2.ResumeLayout(false);
this.panel2.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 panel2;
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;
}
}
+279
View File
@@ -0,0 +1,279 @@
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 BaseForm : 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 BaseForm()
{
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;
}
}
}
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>
+145
View File
@@ -0,0 +1,145 @@
namespace Work.BaseForms
{
partial class BaseMsgForm
{
/// <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.panel2 = new System.Windows.Forms.Panel();
this.pnlCancel = new DevComponents.DotNetBar.PanelEx();
this.pnlConfirm = new DevComponents.DotNetBar.PanelEx();
this.picTip = new System.Windows.Forms.PictureBox();
this.lblMsg = new System.Windows.Forms.Label();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picTip)).BeginInit();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Controls.Add(this.pnlCancel);
this.panel2.Controls.Add(this.pnlConfirm);
this.panel2.Controls.Add(this.picTip);
this.panel2.Controls.Add(this.lblMsg);
this.panel2.Location = new System.Drawing.Point(3, 32);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(382, 182);
this.panel2.TabIndex = 2;
//
// pnlCancel
//
this.pnlCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pnlCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlCancel.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlCancel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pnlCancel.Location = new System.Drawing.Point(280, 132);
this.pnlCancel.Name = "pnlCancel";
this.pnlCancel.Size = new System.Drawing.Size(80, 30);
this.pnlCancel.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.pnlCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.pnlCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.pnlCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.pnlCancel.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
this.pnlCancel.Style.ForeColor.Color = System.Drawing.Color.Black;
this.pnlCancel.Style.GradientAngle = 90;
this.pnlCancel.TabIndex = 43;
this.pnlCancel.Text = "取 消";
this.pnlCancel.Click += new System.EventHandler(this.pnlCancel_Click);
//
// pnlConfirm
//
this.pnlConfirm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pnlConfirm.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlConfirm.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlConfirm.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlConfirm.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pnlConfirm.Location = new System.Drawing.Point(163, 132);
this.pnlConfirm.Name = "pnlConfirm";
this.pnlConfirm.Size = new System.Drawing.Size(80, 30);
this.pnlConfirm.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlConfirm.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.pnlConfirm.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.pnlConfirm.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.pnlConfirm.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.pnlConfirm.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.pnlConfirm.Style.ForeColor.Color = System.Drawing.Color.White;
this.pnlConfirm.Style.GradientAngle = 90;
this.pnlConfirm.TabIndex = 42;
this.pnlConfirm.Text = "确 定";
this.pnlConfirm.Click += new System.EventHandler(this.pnlConfirm_Click);
//
// picTip
//
this.picTip.Location = new System.Drawing.Point(25, 52);
this.picTip.Name = "picTip";
this.picTip.Size = new System.Drawing.Size(64, 64);
this.picTip.TabIndex = 41;
this.picTip.TabStop = false;
//
// lblMsg
//
this.lblMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMsg.Location = new System.Drawing.Point(112, 52);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(248, 65);
this.lblMsg.TabIndex = 40;
this.lblMsg.Text = "信息";
this.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// BaseMsgForm
//
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(388, 217);
this.Controls.Add(this.panel2);
this.Location = new System.Drawing.Point(0, 0);
this.Name = "BaseMsgForm";
this.Text = "BaseMsgForm";
this.TitleText = "BaseMsgForm";
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
this.Controls.SetChildIndex(this.panel2, 0);
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picTip)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel2;
private DevComponents.DotNetBar.PanelEx pnlCancel;
private DevComponents.DotNetBar.PanelEx pnlConfirm;
private System.Windows.Forms.PictureBox picTip;
private System.Windows.Forms.Label lblMsg;
}
}
+136
View File
@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Work.BaseForms
{
public partial class BaseMsgForm : BaseForm
{
public BaseMsgForm()
{
InitializeComponent();
this.Minimized = this.MinimizeBox = false;
this.AcceptButton = pnlConfirm;
SetWindowRegion();
}
#region 设置窗体圆角
/// <summary>
/// 设置窗体的Region
/// </summary>
public void SetWindowRegion()
{
//GraphicsPath FormPath;
//Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
//FormPath = GetRoundedRectPath(rect, 6);
//this.Region = new Region(FormPath);
Helper.WindowStyle.SetFormRoundRectRgn(this, 6);
Helper.WindowStyle.SetFormRoundRectRgn(this.panel2, 5);
}
/// <summary>
/// 绘制圆角路径
/// </summary>
/// <param name="rect"></param>
/// <param name="radius"></param>
/// <returns></returns>
private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
{
int diameter = radius;
Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
GraphicsPath path = new GraphicsPath();
// 左上角
path.AddArc(arcRect, 180, 90);
// 右上角
arcRect.X = rect.Right - diameter;
path.AddArc(arcRect, 270, 90);
// 右下角
arcRect.Y = rect.Bottom - diameter;
path.AddArc(arcRect, 0, 90);
// 左下角
arcRect.X = rect.Left;
path.AddArc(arcRect, 90, 90);
path.CloseFigure();//闭合曲线
return path;
}
#endregion
public static BaseMsgForm ShowInfo(string msg, string caption = "", FormLevel fl = FormLevel.MEDIUM)
{
string title = string.IsNullOrEmpty(caption) ? "系统提示" : caption;
BaseMsgForm msgBox = CreateMsgForm(msg, fl, title);
msgBox.picTip.Image = global::Work.Properties.Resources.BaseMsgInfo;
msgBox.ShowDialog();
return msgBox;
}
private static BaseMsgForm CreateMsgForm(string msg, FormLevel fl, string title)
{
BaseMsgForm msgBox = new BaseMsgForm { Text = title, lblMsg = { Text = msg }, TitleText = title };
if (fl.Equals(FormLevel.LARGE))
{
msgBox.Width = (int)FormLevel.LARGE;
msgBox.Height = 280;
}
msgBox.pnlConfirm.Location = msgBox.pnlCancel.Location; // 把确认按钮移到取消按钮上面
msgBox.pnlCancel.Visible = false;
return msgBox;
}
public static BaseMsgForm ShowError(string msg, string caption = "", FormLevel fl = FormLevel.MEDIUM)
{
string title = string.IsNullOrEmpty(caption) ? "系统错误" : caption;
BaseMsgForm msgBox = CreateMsgForm(msg, fl, title);
msgBox.picTip.Image = global::Work.Properties.Resources.BaseMsgErr;
msgBox.ShowDialog();
return msgBox;
}
public static BaseMsgForm ShowConfirm(string msg, string caption = "", FormLevel fl = FormLevel.MEDIUM)
{
string title = string.IsNullOrEmpty(caption) ? "系统提示确认" : caption;
BaseMsgForm msgBox = new BaseMsgForm
{
Text = title,
lblMsg = { Text = msg },
TitleText = title,
picTip = { Image = global::Work.Properties.Resources.BaseMsgQue }
};
if (fl.Equals(FormLevel.LARGE))
{
msgBox.Width = (int)FormLevel.LARGE;
}
msgBox.ShowDialog();
return msgBox;
}
private void pnlConfirm_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
private void pnlCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
public enum FormLevel
{
SMALL,
MEDIUM,
LARGE = 500
}
}
+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>