# HG changeset patch # User IBBoard # Date 1253130639 0 # Node ID e6d0d9eababf76a6b68ab7b6124415d7c211419a # Parent 4a56900936aa7c213724bbf0d75d14396372ec9c Fixes #163: Show unit cost on unit dialog * Add a quick label with the points cost of the unit - can be moved and repositioned based on user feedback diff -r 4a56900936aa -r e6d0d9eababf FrmUnit.cs --- a/FrmUnit.cs Wed Sep 16 19:41:27 2009 +0000 +++ b/FrmUnit.cs Wed Sep 16 19:50:39 2009 +0000 @@ -40,6 +40,7 @@ private System.Windows.Forms.Label lblOptionalEquip; private System.Windows.Forms.Button bttnReplaceWeapon; private System.Windows.Forms.Button bttnEditReqdWeapon; + private Label lblPoints; /// /// Required designer variable. /// @@ -59,6 +60,7 @@ unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); + unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); if (unit.UnitType.MaxSize == unit.UnitType.MinSize) { @@ -73,10 +75,21 @@ unitSize.Minimum = unit.UnitType.MinSize; } + SetPointsValueText(); SetStats(); SetWeapons(); } + void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) + { + SetPointsValueText(); + } + + private void SetPointsValueText() + { + lblPoints.Text = "(" + unit.PointsValue + " pts)"; + } + private void SetStats() { DataTable dt = new DataTable(); @@ -188,6 +201,7 @@ this.lblOptionalEquip = new System.Windows.Forms.Label(); this.bttnReplaceWeapon = new System.Windows.Forms.Button(); this.bttnEditReqdWeapon = new System.Windows.Forms.Button(); + this.lblPoints = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.statsGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit(); this.SuspendLayout(); @@ -350,10 +364,18 @@ this.bttnEditReqdWeapon.Text = "edit"; this.bttnEditReqdWeapon.Click += new System.EventHandler(this.bttnEditReqdWeapon_Click); // + // lblPoints + // + this.lblPoints.Location = new System.Drawing.Point(358, 8); + this.lblPoints.Name = "lblPoints"; + this.lblPoints.Size = new System.Drawing.Size(100, 21); + this.lblPoints.TabIndex = 12; + // // FrmUnit // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(616, 314); + this.Controls.Add(this.lblPoints); this.Controls.Add(this.bttnEditReqdWeapon); this.Controls.Add(this.bttnReplaceWeapon); this.Controls.Add(this.optList);