コード例 #1
0
ファイル: ArgumentCollectionUI.cs プロジェクト: rkm/RDMP
        private void RefreshArgumentList()
        {
            var argumentFactory = new ArgumentFactory();

            DemandDictionary = argumentFactory.GetDemandDictionary(_parent, _argumentsAreFor);

            lblNoArguments.Visible = !DemandDictionary.Any();
            pArguments.Visible     = DemandDictionary.Any();

            if (!DemandDictionary.Any())
            {
                return;
            }

            pArguments.Controls.Clear();
            pArguments.SuspendLayout();

            var headerLabel = GetLabelHeader("Arguments");

            pArguments.Controls.Add(headerLabel);

            _currentY       = headerLabel.Height;
            _maxValueUILeft = 0;
            _valueUIs.Clear();

            foreach (var kvp in DemandDictionary)
            {
                CreateLine(_parent, kvp.Key, kvp.Value);
            }

            foreach (Control control in _valueUIs)
            {
                control.Left  = _maxValueUILeft;
                control.Width = pArguments.Width - (_maxValueUILeft + 25);
                control.Parent.MinimumSize = new Size(_maxValueUILeft + control.MinimumSize.Width, control.Parent.Height);
            }

            pArguments.ResumeLayout(true);
        }
コード例 #2
0
        private void RefreshArgumentList()
        {
            var argumentFactory = new ArgumentFactory();

            DemandDictionary = argumentFactory.GetDemandDictionary(_parent, _argumentsAreFor);

            lblNoArguments.Visible = !DemandDictionary.Any();
            pArguments.Visible     = DemandDictionary.Any();

            if (!DemandDictionary.Any())
            {
                return;
            }

            pArguments.Controls.Clear();
            pArguments.SuspendLayout();

            float maxArgNameWidth = 0;

            if (DemandDictionary.Any())
            {
                var g = this.CreateGraphics();
                maxArgNameWidth = DemandDictionary.Select(a =>
                                                          g.MeasureString(UsefulStuff.PascalCaseStringToHumanReadable(a.Value.Name), Label.DefaultFont).Width)
                                  .Max();
            }


            foreach (var kvp in DemandDictionary)
            {
                CreateLine(_parent, kvp.Key, kvp.Value, maxArgNameWidth);
            }

            //headerLabel.SendToBack();
            pArguments.ResumeLayout(true);
        }