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


C# ListView.PerformLayout方法代码示例

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


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

示例1: SetViewMode

        private void SetViewMode(ListView view, View newViewMode)
        {
            // Keep the old column states if we go away from details mode.
              // They will be restored later when we go back to details view and have
              // added the columns again.
              if (view.View == View.Details)
            SaveColumnStates(view);

              if (view.View != newViewMode)
              {
            switch (newViewMode)
            {
              case View.Tile:
            view.View = newViewMode;
            view.TileSize = new Size(140, 17);
            view.LargeImageList = IconManagerWrapper.ImageList16;
            break;
              case View.LargeIcon:
            view.View = newViewMode;
            view.LargeImageList = IconManagerWrapper.ImageList48;
            break;
              case View.Details:
            // This call will make the scrollbars visible for a moment but works around a more serious problem.
            // When the listview is switched to report mode without scrollbars being visible then it will not adjust
            // its client area for the header and parts of the first items are hidden behind the header.
            view.Scrollable = true;
            view.View = newViewMode;
            view.Scrollable = false;
            break;
            }

            // Adjust item image indices, as they might not be the same for large and small icons.
            for (int i = 0; i < view.Items.Count; i++)
            {
              NodeIdWrapper id = (view.Items[i].Tag as Identifier).id;
              view.Items[i].ImageIndex = FindImageIndex(id, view.View);
            }
            view.PerformLayout();
              }
        }
开发者ID:eworm-de,项目名称:mysql-workbench,代码行数:40,代码来源:ModelOverviewForm.cs

示例2: PopulateListView

        private void PopulateListView(NodeIdWrapper parentNodeId, ListView listView)
        {
            listView.BeginUpdate();
              try
              {
            int itemCount = wbOverview.count_children(parentNodeId);
            ListViewItem[] items = new ListViewItem[itemCount];

            int detail_fields_count = wbOverview.get_details_field_count(parentNodeId);

            for (int i = 0; i < itemCount; i++)
            {
              NodeIdWrapper itemNodeId = wbOverview.get_child(parentNodeId, i);
              string caption;

              wbOverview.get_field(itemNodeId, (int)Overview.Columns.Label, out caption);
              ListViewItem item = new ListViewItem(caption, FindImageIndex(itemNodeId, listView.View));
              item.Tag = CreateIdentifier(itemNodeId);
              item.ToolTipText = caption;

              // Add details for that item, if available.
              for (int counter = 0; counter < detail_fields_count; counter++)
              {
            String detailText;
            wbOverview.get_field(itemNodeId, (int)Overview.Columns.FirstDetailField + counter, out detailText);
            item.SubItems.Add(detailText.Replace(Environment.NewLine, " / "));
              }

              items[i] = item;
            }
            listView.Items.Clear();
            listView.Items.AddRange(items);

            // Setting the sorter also starts sorting.
            listView.ListViewItemSorter = new InsensitiveListviewComparer(0, SortOrder.Ascending);
            Win32.SetSortIcon(listView, 0, SortOrder.Ascending);

            // select stuff
            List<int> selected = wbOverview.get_selected_children(parentNodeId);
            foreach (int i in selected)
              listView.SelectedIndices.Add(i);
              }
              finally
              {
            listView.EndUpdate();
            listView.PerformLayout();
              };
        }
开发者ID:eworm-de,项目名称:mysql-workbench,代码行数:48,代码来源:ModelOverviewForm.cs


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