コード例 #1
0
ファイル: UIGenerator.cs プロジェクト: Syntasu/hp-calc
 public void SetControlVisibility(string name, bool state)
 {
     foreach (var control in Controls)
     {
         if (control.Key.ToLower() == name.ToLower())
         {
             UIDesc description = control.Value;
             description.Visible = state;
             description.DetermineVisibillity();
         }
     }
 }
コード例 #2
0
ファイル: UIGenerator.cs プロジェクト: Syntasu/hp-calc
        /// <summary>
        ///     Refresh the positions and the size of the user interface.
        ///     We adjust the grid and translate all the positions and sizes again.
        /// </summary>
        /// <param name="width"> The current width. </param>
        /// <param name="height"> The current height. </param>
        public void Refresh(int width, int height)
        {
            grid.Refresh(width, height);

            //Read in the descriptions, use that to determine location and size.
            foreach (var control in Controls)
            {
                UIDesc desc = control.Value;

                desc.ControlRef.Location = grid.Translate(desc.Position.x, desc.Position.y);
                desc.ControlRef.Size     = grid.Translate(desc.Size.x, desc.Size.y);
                desc.DetermineVisibillity();
            }
        }