当前位置: 首页>>代码示例>>C#>>正文


C# ListBox.PerformLayout方法代码示例

本文整理汇总了C#中ListBox.PerformLayout方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.PerformLayout方法的具体用法?C# ListBox.PerformLayout怎么用?C# ListBox.PerformLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListBox的用法示例。


在下文中一共展示了ListBox.PerformLayout方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConstructTabPage

        /// <summary>
        /// Instantiate and initialize a new <c>TabPage</c> control to display the self tests associated with a particular self test group.
        /// </summary>
        /// <remarks>The member variable <c>m_TestItems</c> must be initialized before calling this method.</remarks>
        /// <param name="groupListRecord">Reference to the group list associated with the TabPage.</param>
        /// <returns>The initialized <c>TabPage</c> control.</returns>
        private TabPage ConstructTabPage(GroupListRecord groupListRecord)
        {
            TabPage tabPage = new TabPage(groupListRecord.Description);

            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return tabPage;
            }

            // Configure the ListBox control.
            ListBox listBox = new ListBox();
            listBox.Location = new System.Drawing.Point(8, 24);
            listBox.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
            listBox.Name = KeyListBoxAvailable + groupListRecord.Identifier.ToString();
            listBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            listBox.Size = new System.Drawing.Size(282, 264);
            listBox.TabIndex = 1;
            listBox.SelectedIndexChanged += new EventHandler(ListBoxAvailable_SelectedIndexChanged);
            listBox.DoubleClick += new System.EventHandler(this.m_ButtonAdd_Click);
            listBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseDown);
            listBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseMove);
            listBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.m_ListBoxSource_MouseUp);
            listBox.ContextMenuStrip = m_ContextMenuAll;

            Label legendAvailableTests = new Label();
            legendAvailableTests.AutoSize = true;
            legendAvailableTests.Text = Resources.LegendAvailableTests;
            legendAvailableTests.Location = new Point(5, 8);

            Label labelCount = new Label();
            labelCount.Name = KeyLabelAvailableCount + groupListRecord.Identifier.ToString();
            labelCount.AutoSize = true;
            labelCount.Location = new Point(5, 291);

            // ---------------------------------------------------------------
            // Add the self tests associated with the current self test group.
            // ---------------------------------------------------------------
            // The list of test items that are to be added to the ListBox control. The type parameter must be an object type rather than a TestItem_t type so that
            // the ToArray() method can be used to generate an object[] which can then be added to existing the ListBox.Items using the AddRange() method.
            List<object> testItemList = new List<object>();
            TestItem_t testItem;
            SelfTestRecord selfTestRecord;
            for (int index = 0; index < groupListRecord.SelfTestRecordList.Count; index++)
            {
                selfTestRecord = groupListRecord.SelfTestRecordList[index];

                // Check that the self test exists.
                try
                {
                    testItem = m_TestItems[selfTestRecord.Identifier];
                }
                catch (Exception)
                {
                    continue;
                }

                if ((testItem.Exists == true) &&
                    (testItem.Added == false))
                {
                    testItemList.Add(testItem);
                }
            }

            listBox.SuspendLayout();
            listBox.Items.Clear();
            listBox.Items.AddRange(testItemList.ToArray());
            listBox.PerformLayout();

            // Configure the TabPage.
            tabPage.Tag = groupListRecord.Identifier;
            tabPage.AutoScroll = true;
            tabPage.BackColor = Color.FromKnownColor(KnownColor.Window);
            tabPage.Controls.Add(legendAvailableTests);
            tabPage.Controls.Add(listBox);
            tabPage.Controls.Add(labelCount);

            return tabPage;
        }
开发者ID:SiGenixDave,项目名称:PtuPCNew,代码行数:85,代码来源:FormTestListDefine.cs

示例2: TestItemAddRange

        /// <summary>
        /// Add the self tests defined in the specified test list the specified <c>ListBox</c> control.
        /// </summary>
        /// <param name="listBox">The <c>ListBox</c> to which the items are to be added.</param>
        /// <param name="testListRecord">The test list that is to be added to the <c>ListBox</c> control.</param>
        private void TestItemAddRange(ListBox listBox, TestListRecord testListRecord)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;

            listBox.Items.Clear();
            listBox.SuspendLayout();

            TestItem_t testItem;
            short selfTestIdentifier, selfTestNumber;
            for (int index = 0; index < testListRecord.SelfTestRecordList.Count; index++)
            {
                testItem = new TestItem_t();
                selfTestIdentifier = testListRecord.SelfTestRecordList[index].Identifier;
                selfTestNumber = testListRecord.SelfTestRecordList[index].SelfTestNumber;
                testItem.SelfTestIdentifier = selfTestIdentifier;
                testItem.SelfTestNumber = selfTestNumber;
                testItem.Added = true;
                listBox.Items.Add(testItem);
            }

            listBox.PerformLayout();
            Cursor = Cursors.Default;
        }
开发者ID:SiGenixDave,项目名称:PtuPCNew,代码行数:34,代码来源:FormTestListDefine.cs

示例3: WatchItemAddRange

        /// <summary>
        /// Add the watch variables defined in the specified list of old identifiers to the specified <c>ListBox</c> control.
        /// </summary>
        /// <param name="listBox">The <c>ListBox</c> to which the items are to be added.</param>
        /// <param name="plotTabPage">The plot tab page of the workset that is to be added to the <c>ListBox</c> control.</param>
        protected void WatchItemAddRange(ListBox listBox, PlotTabPage_t plotTabPage)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;
            List<short> oldIdentifierList = plotTabPage.OldIdentifierList;
            List<uint> displayMaskList = plotTabPage.DisplayMaskList;

            Debug.Assert(oldIdentifierList.Count == displayMaskList.Count, "FormPlotDefine.WatchItemAddRange() - oldIdentifierList.Count == displayMaskList.Count[]");

            listBox.Items.Clear();
            listBox.SuspendLayout();

            WatchItem_t watchItem;
            short oldIdentifier;
            uint displayMask;
            for (int index = 0; index < oldIdentifierList.Count; index++)
            {
                watchItem = new WatchItem_t();
                oldIdentifier = oldIdentifierList[index];
                displayMask = displayMaskList[index];
                watchItem.OldIdentifier = oldIdentifier;

                // The DisplayMask field is only applicable to bitmask watch variables and is used to define which bits of the bitmask watch variable.
                watchItem.DisplayMask = displayMask;
                watchItem.Added = true;
                listBox.Items.Add(watchItem);
            }

            listBox.PerformLayout();
            Cursor = Cursors.Default;
        }
开发者ID:SiGenixDave,项目名称:PtuPCNew,代码行数:41,代码来源:FormPlotDefine.cs

示例4: WatchItemAddRange


//.........这里部分代码省略.........
            listBox.Items.Clear();
            m_ListBoxChartScaleUpperLimit.Items.Clear();
            m_ListBoxChartScaleLowerLimit.Items.Clear();
            m_ListBoxUnits.Items.Clear();

            listBox.SuspendLayout();
            m_ListBoxChartScaleUpperLimit.SuspendLayout();
            m_ListBoxChartScaleLowerLimit.SuspendLayout();
            m_ListBoxUnits.SuspendLayout();

            bool hexFormat = false;
            WatchItem_t watchItem;
            short oldIdentifier;
            WatchVariable watchVariable;
            ChartScale_t chartScale;
            for (int index = 0; index < worksetColumn.OldIdentifierList.Count; index++)
            {
                watchItem = new WatchItem_t();
                oldIdentifier = worksetColumn.OldIdentifierList[index];
                watchItem.OldIdentifier = oldIdentifier;
                watchItem.Added = true;
                m_ListBox1.Items.Add(watchItem);

                // Check whether the watch variable exists.
                try
                {
                    watchVariable = Lookup.WatchVariableTableByOldIdentifier.RecordList[oldIdentifier];
                    if (watchVariable == null)
                    {
                        throw new Exception();
                    }

                    // Determine the format of the watch variable.
                    hexFormat = (watchVariable.FormatString.ToLower().Equals(CommonConstants.DDFormatStringHex)) ? true : false;

                    // Check whether the chart scaling for the current watch variable has been defined.
                    try
                    {
                        chartScale = worksetColumn.ChartScaleList[index];
                    }
                    catch (Exception)
                    {
                        // No - Set up the default chart scaling for the watch variable based upon the data dictionary.
                        chartScale = new ChartScale_t();
                        chartScale.ChartScaleLowerLimit = watchVariable.MinChartScale;
                        chartScale.ChartScaleUpperLimit = watchVariable.MaxChartScale;
                        chartScale.Units = watchVariable.Units;
                    }
                }
                catch (Exception)
                {
                    // Watch variable does not exist.
                    chartScale.ChartScaleLowerLimit = double.NaN;
                    chartScale.ChartScaleUpperLimit = double.NaN;
                    chartScale.Units = CommonConstants.ChartScaleUnitsNotDefinedString;
                }

                // Rather tha displaying 'NaN' if the chart scale values are undefined, display the default string used to represent a chart scale value that is not defined.
                if (chartScale.ChartScaleLowerLimit.Equals(double.NaN))
                {
                    m_ListBoxChartScaleLowerLimit.Items.Add(CommonConstants.ChartScaleValueNotDefinedString);
                }
                else
                {
                    if (hexFormat == true)
                    {
                        m_ListBoxChartScaleLowerLimit.Items.Add(CommonConstants.HexValueIdentifier + ((uint)chartScale.ChartScaleLowerLimit).ToString(CommonConstants.FormatStringHex));
                    }
                    else
                    {
                        m_ListBoxChartScaleLowerLimit.Items.Add(chartScale.ChartScaleLowerLimit.ToString(CommonConstants.FormatStringNumeric));
                    }
                }

                if (chartScale.ChartScaleUpperLimit.Equals(double.NaN))
                {
                    m_ListBoxChartScaleUpperLimit.Items.Add(CommonConstants.ChartScaleValueNotDefinedString);
                }
                else
                {
                    if (hexFormat == true)
                    {
                        m_ListBoxChartScaleUpperLimit.Items.Add(CommonConstants.HexValueIdentifier + ((uint)chartScale.ChartScaleUpperLimit).ToString(CommonConstants.FormatStringHex));
                    }
                    else
                    {
                        m_ListBoxChartScaleUpperLimit.Items.Add(chartScale.ChartScaleUpperLimit.ToString(CommonConstants.FormatStringNumeric));
                    }
                }

                m_ListBoxUnits.Items.Add(chartScale.Units);
            }

            listBox.PerformLayout();
            m_ListBoxChartScaleLowerLimit.PerformLayout();
            m_ListBoxChartScaleUpperLimit.PerformLayout();
            m_ListBoxUnits.PerformLayout();

            Cursor = Cursors.Default;
        }
开发者ID:SiGenixDave,项目名称:PtuPCNew,代码行数:101,代码来源:FormWorksetDefineChartRecorder.cs

示例5: WatchItemAddRange

        /// <summary>
        /// Add the watch variables defined in the specified list of old identifiers to the specified <c>ListBox</c> control.
        /// </summary>
        /// <param name="listBox">The <c>ListBox</c> to which the items are to be added.</param>
        /// <param name="worksetColumn">The column of the workset that is to be added to the <c>ListBox</c> control.</param>
        protected virtual void WatchItemAddRange(ListBox listBox, Column_t worksetColumn)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;
            List<short> oldIdentifierList = worksetColumn.OldIdentifierList;

            listBox.Items.Clear();
            listBox.SuspendLayout();

            WatchItem_t watchItem;
            short oldIdentifier;
            for (int index = 0; index < oldIdentifierList.Count; index++)
            {
                watchItem = new WatchItem_t();
                oldIdentifier = oldIdentifierList[index];
                watchItem.OldIdentifier = oldIdentifier;
                watchItem.Added = true;

                // The DisplayMask field is only applicable to bitmask watch variables and is used to define which bits of the bitmask watch variable
                // are to be plotted.
                watchItem.DisplayMask = uint.MaxValue;
                listBox.Items.Add(watchItem);
            }

            listBox.PerformLayout();
            Cursor = Cursors.Default;
        }
开发者ID:SiGenixDave,项目名称:PtuPCNew,代码行数:37,代码来源:FormWorksetDefine.cs


注:本文中的ListBox.PerformLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。