commit f66b4436b9ff1b4546e86e0c03c6f763c6219137 Author: robin Date: Thu Sep 7 14:47:08 2017 +0800 init diff --git a/B3ButcherWeightClient.sln b/B3ButcherWeightClient.sln new file mode 100644 index 0000000..c101f06 --- /dev/null +++ b/B3ButcherWeightClient.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "B3ButcherWeightClient", "B3ButcherWeightClient\B3ButcherWeightClient.csproj", "{758A679D-2138-41EE-9675-7CC83B85AD15}" + ProjectSection(ProjectDependencies) = postProject + {2EAEFC6A-1B91-4D58-A793-B25462CA9225} = {2EAEFC6A-1B91-4D58-A793-B25462CA9225} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BO", "BO\BO.csproj", "{2EAEFC6A-1B91-4D58-A793-B25462CA9225}" +EndProject + +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {758A679D-2138-41EE-9675-7CC83B85AD15}.Debug|Any CPU.ActiveCfg = Debug|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Debug|x86.ActiveCfg = Debug|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Debug|x86.Build.0 = Debug|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Release|Any CPU.ActiveCfg = Release|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Release|Mixed Platforms.Build.0 = Release|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Release|x86.ActiveCfg = Release|x86 + {758A679D-2138-41EE-9675-7CC83B85AD15}.Release|x86.Build.0 = Release|x86 + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Debug|x86.ActiveCfg = Debug|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Release|Any CPU.Build.0 = Release|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2EAEFC6A-1B91-4D58-A793-B25462CA9225}.Release|x86.ActiveCfg = Release|Any CPU + {1367E4CD-C7CA-4C4D-BF37-EC0D9BF949F3}.Debug|Any CPU.ActiveCfg = Debug + {1367E4CD-C7CA-4C4D-BF37-EC0D9BF949F3}.Debug|Mixed Platforms.ActiveCfg = Debug + {1367E4CD-C7CA-4C4D-BF37-EC0D9BF949F3}.Debug|x86.ActiveCfg = Debug + {1367E4CD-C7CA-4C4D-BF37-EC0D9BF949F3}.Release|Any CPU.ActiveCfg = Release + {1367E4CD-C7CA-4C4D-BF37-EC0D9BF949F3}.Release|Mixed Platforms.ActiveCfg = Release + {1367E4CD-C7CA-4C4D-BF37-EC0D9BF949F3}.Release|x86.ActiveCfg = Release + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/B3ButcherWeightClient/AutoSizeFormClass.cs b/B3ButcherWeightClient/AutoSizeFormClass.cs new file mode 100644 index 0000000..ba77d88 --- /dev/null +++ b/B3ButcherWeightClient/AutoSizeFormClass.cs @@ -0,0 +1,109 @@ +using System.Collections.Generic; +using System.Windows.Forms; + +namespace B3ButcherWeightClient { + class AutoSizeFormClass { + //(1).声明结构,只记录窗体和其控件的初始位置和大小。 + public struct controlRect { + public int Left; + public int Top; + public int Width; + public int Height; + } + //(2).声明 1个对象 + //注意这里不能使用控件列表记录 List nCtrl;,因为控件的关联性,记录的始终是当前的大小。 + // public List oldCtrl= new List();//这里将西文的大于小于号都过滤掉了,只能改为中文的,使用中要改回西文 + public List oldCtrl = new List(); + int ctrlNo = 0;//1; + //(3). 创建两个函数 + //(3.1)记录窗体和其控件的初始位置和大小, + public void ControllInitializeSize(Control mForm) { + controlRect cR; + cR.Left = mForm.Left; + cR.Top = mForm.Top; + cR.Width = mForm.Width; + cR.Height = mForm.Height; + oldCtrl.Add(cR);//第一个为"窗体本身",只加入一次即可 + AddControl(mForm);//窗体内其余控件还可能嵌套控件(比如panel),要单独抽出,因为要递归调用 + //this.WindowState = (System.Windows.Forms.FormWindowState)(2);//记录完控件的初始位置和大小后,再最大化 + //0 - Normalize , 1 - Minimize,2- Maximize + } + private void AddControl(Control ctl) { + foreach (Control c in ctl.Controls) { //**放在这里,是先记录控件的子控件,后记录控件本身 + //if (c.Controls.Count > 0) + // AddControl(c);//窗体内其余控件还可能嵌套控件(比如panel),要单独抽出,因为要递归调用 + controlRect objCtrl; + objCtrl.Left = c.Left; + objCtrl.Top = c.Top; + objCtrl.Width = c.Width; + objCtrl.Height = c.Height; + oldCtrl.Add(objCtrl); + //**放在这里,是先记录控件本身,后记录控件的子控件 + if (c.Controls.Count > 0) + AddControl(c);//窗体内其余控件还可能嵌套控件(比如panel),要单独抽出,因为要递归调用 + } + } + //(3.2)控件自适应大小, + public void controlAutoSize(Control mForm) { + if (ctrlNo == 0) { //*如果在窗体的Form1_Load中,记录控件原始的大小和位置,正常没有问题,但要加入皮肤就会出现问题,因为有些控件如dataGridView的的子控件还没有完成,个数少 + //*要在窗体的Form1_SizeChanged中,第一次改变大小时,记录控件原始的大小和位置,这里所有控件的子控件都已经形成 + controlRect cR; + // cR.Left = mForm.Left; cR.Top = mForm.Top; cR.Width = mForm.Width; cR.Height = mForm.Height; + cR.Left = 0; + cR.Top = 0; + cR.Width = mForm.PreferredSize.Width; + cR.Height = mForm.PreferredSize.Height; + + oldCtrl.Add(cR);//第一个为"窗体本身",只加入一次即可 + AddControl(mForm);//窗体内其余控件可能嵌套其它控件(比如panel),故单独抽出以便递归调用 + } + float wScale = (float)mForm.Width / (float)oldCtrl[0].Width;//新旧窗体之间的比例,与最早的旧窗体 + float hScale = (float)mForm.Height / (float)oldCtrl[0].Height;//.Height; + ctrlNo = 1;//进入=1,第0个为窗体本身,窗体内的控件,从序号1开始 + AutoScaleControl(mForm, wScale, hScale);//窗体内其余控件还可能嵌套控件(比如panel),要单独抽出,因为要递归调用 + } + + private void AutoScaleControl(Control ctl, float wScale, float hScale) { + int ctrLeft0, ctrTop0, ctrWidth0, ctrHeight0; + //int ctrlNo = 1;//第1个是窗体自身的 Left,Top,Width,Height,所以窗体控件从ctrlNo=1开始 + foreach (Control c in ctl.Controls) { //**放在这里,是先缩放控件的子控件,后缩放控件本身 + //if (c.Controls.Count > 0) + // AutoScaleControl(c, wScale, hScale);//窗体内其余控件还可能嵌套控件(比如panel),要单独抽出,因为要递归调用 + ctrLeft0 = oldCtrl[ctrlNo].Left; + ctrTop0 = oldCtrl[ctrlNo].Top; + ctrWidth0 = oldCtrl[ctrlNo].Width; + ctrHeight0 = oldCtrl[ctrlNo].Height; + //c.Left = (int)((ctrLeft0 - wLeft0) * wScale) + wLeft1;//新旧控件之间的线性比例 + //c.Top = (int)((ctrTop0 - wTop0) * h) + wTop1; + c.Left = (int)((ctrLeft0) * wScale);//新旧控件之间的线性比例。控件位置只相对于窗体,所以不能加 + wLeft1 + c.Top = (int)((ctrTop0) * hScale);// + c.Width = (int)(ctrWidth0 * wScale);//只与最初的大小相关,所以不能与现在的宽度相乘 (int)(c.Width * w); + c.Height = (int)(ctrHeight0 * hScale);// + ctrlNo++;//累加序号 + //**放在这里,是先缩放控件本身,后缩放控件的子控件 + if (c.Controls.Count > 0) + AutoScaleControl(c, wScale, hScale);//窗体内其余控件还可能嵌套控件(比如panel),要单独抽出,因为要递归调用 + + if (ctl is DataGridView) { + //var dgv = ctl as DataGridView; + //Cursor.Current = Cursors.WaitCursor; + + //var widths = 0; + //for (int i = 0; i < dgv.Columns.Count; i++) { + // dgv.AutoResizeColumn(i, DataGridViewAutoSizeColumnMode.AllCells); // 自动调整列宽 + // widths += dgv.Columns[i].Width; // 计算调整列后单元列的宽度和 + //} + //if (widths >= ctl.Size.Width) // 如果调整列的宽度大于设定列宽 + // dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; // 调整列的模式 自动 + //else + // dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; // 如果小于 则填充 + + //Cursor.Current = Cursors.Default; + } + } + + + } + } + +} diff --git a/B3ButcherWeightClient/B3ButcherWeightClient.csproj b/B3ButcherWeightClient/B3ButcherWeightClient.csproj new file mode 100644 index 0000000..6efab63 --- /dev/null +++ b/B3ButcherWeightClient/B3ButcherWeightClient.csproj @@ -0,0 +1,168 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {758A679D-2138-41EE-9675-7CC83B85AD15} + WinExe + Properties + B3ButcherWeightClient + B3ButcherWeightClient + v4.0 + 512 + + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + logo.ico + + + + False + ..\..\..\tsref\Debug\Forks.EnterpriseServices.dll + + + + + True + + + + + + + + + + + + + + + Form + + + ChangeLevelForm.cs + + + + + + + + + Form + + + QueryForm.cs + + + + + + + Form + + + Livestock.cs + + + Form + + + Main.cs + + + Form + + + Login.cs + + + + + Form + + + Setting.cs + + + ChangeLevelForm.cs + + + Livestock.cs + + + Main.cs + Designer + + + Login.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + QueryForm.cs + + + Setting.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {2EAEFC6A-1B91-4D58-A793-B25462CA9225} + BO + + + + + + + + + + \ No newline at end of file diff --git a/B3ButcherWeightClient/ChangeLevelForm.Designer.cs b/B3ButcherWeightClient/ChangeLevelForm.Designer.cs new file mode 100644 index 0000000..8db1a99 --- /dev/null +++ b/B3ButcherWeightClient/ChangeLevelForm.Designer.cs @@ -0,0 +1,62 @@ +namespace B3ButcherWeightClient +{ + partial class ChangeLevelForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.AutoScroll = true; + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Location = new System.Drawing.Point(1, 2); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(627, 539); + this.panel1.TabIndex = 7; + // + // ChangeLevelForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(630, 541); + this.Controls.Add(this.panel1); + this.MaximizeBox = false; + this.Name = "ChangeLevelForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "修改级别"; + this.Load += new System.EventHandler(this.ChangeLevelForm_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + } +} \ No newline at end of file diff --git a/B3ButcherWeightClient/ChangeLevelForm.cs b/B3ButcherWeightClient/ChangeLevelForm.cs new file mode 100644 index 0000000..7a6d5cb --- /dev/null +++ b/B3ButcherWeightClient/ChangeLevelForm.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace B3ButcherWeightClient +{ + public partial class ChangeLevelForm : Form + { + + readonly IList _dTable = new List(); + + readonly IList