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


C# ListView.Update方法代码示例

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


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

示例1: GetSectionListview


//.........这里部分代码省略.........
        /// </summary>
        private ListView GetSectionListview(NodeIdWrapper controlNodeId, CollapsingPanel overviewPanel, bool addSectionHeader,
            Overview.DisplayMode displayMode, String caption, String info)
        {
            // Iterate over all sections we have already and find the one with the given control id.
              String objectId = wbOverview.get_node_unique_id(controlNodeId);
              foreach (Control control in overviewPanel.Controls)
              {
            if (control.Tag != null)
            {
              String currentObjectId = (control.Tag as Identifier).objectId;
              if (currentObjectId != null && currentObjectId == objectId)
              {
            ListView listview = control as ListView;
            SetViewMode(listview, displayMode);
            return listview;
              }
            }
              }

              // If we come here then the section does not exist yet, so add it. Start with a header.
              if (addSectionHeader)
              {
            Panel panel = new Panel();
            panel.BorderStyle = BorderStyle.None;
            panel.Padding = new Padding(5, 2, 5, 0);
            panel.BackgroundImage = Resources.header_bar_blue;
            panel.BackgroundImageLayout = ImageLayout.None;

            panel.Height = 24;

            // Insert client controls in reverse order.
            // Info label.
            Label infoLabel = new Label();
            infoLabel.Text = info;
            infoLabel.ForeColor = Color.Gray;
            infoLabel.Font = overviewPanel.Font;
            infoLabel.AutoSize = true;
            infoLabel.Margin = new Padding(10, 0, 0, 0);
            infoLabel.Dock = DockStyle.Left;
            panel.Controls.Add(infoLabel);

            overviewPanel.Controls.Add(panel);

            // Caption label.
            Label captionLabel = new Label();
            captionLabel.Text = caption;
            //captionLabel.Font = new Font(overviewPanel.Font, FontStyle.Bold);
            captionLabel.AutoSize = true;
            captionLabel.Dock = DockStyle.Left;
            captionLabel.ForeColor = Color.Black;
            panel.Controls.Add(captionLabel);

            overviewPanel.Controls.Add(panel);
              }

              // Then the content view.
              ListView sectionListview = new ListView();
              sectionListview.BorderStyle = BorderStyle.None;
              sectionListview.AllowColumnReorder = true;
              sectionListview.ShowItemToolTips = true;

              // Undocumented feature: enabling AutoSize will indeed make the control automatically resize
              // (the docs say it wouldn't) though without considering long captions. For them to work
              // additionally Scrollable can be set to true to show a scrollbar, but only in this special case.
              sectionListview.AutoSize = true;
              sectionListview.MultiSelect = false;
              sectionListview.Scrollable = true;
              sectionListview.Visible = true;
              sectionListview.Font = overviewPanel.Font;
              sectionListview.Tag = CreateIdentifier(controlNodeId);
              sectionListview.Sorting = SortOrder.None; // We do custom sort.

              sectionListview.DoubleClick += new EventHandler(listViewDoubleClick);
              sectionListview.ItemDrag += new ItemDragEventHandler(listViewItemDrag);
              sectionListview.SelectedIndexChanged += new EventHandler(listViewSelectedIndexChanged);
              sectionListview.KeyDown += new KeyEventHandler(listViewKeyDown);
              sectionListview.MouseUp += new MouseEventHandler(listViewMouseUp);
              sectionListview.ColumnClick += new ColumnClickEventHandler(ListviewColumnClick);
              sectionListview.Enter += new EventHandler(ListViewEnter);

              // Renaming of overview nodes
              sectionListview.LabelEdit = true;
              sectionListview.AfterLabelEdit += new LabelEditEventHandler(listViewAfterLabelEdit);
              sectionListview.BeforeLabelEdit += new LabelEditEventHandler(listViewBeforeLabelEdit);

              // Add it to the panel. Usually the layout engine of the panel should take care for
              // the layout of the controls, but just to be sure we set here a dock style.
              overviewPanel.Controls.Add(sectionListview);
              sectionListview.Dock = DockStyle.Top;

              // Set Image Lists
              sectionListview.SmallImageList = IconManagerWrapper.ImageList16;
              sectionListview.LargeImageList = IconManagerWrapper.ImageList48;

              SetViewMode(sectionListview, displayMode);

              sectionListview.Update();
              return sectionListview;
        }
开发者ID:eworm-de,项目名称:mysql-workbench,代码行数:101,代码来源:ModelOverviewForm.cs

示例2: InitProcessListView

        private void InitProcessListView(ref ListView TargetListView)
        {
            TargetListView.FullRowSelect = true;
            AddListViewColumns(ref TargetListView);

            TargetListView.Update();
            TargetListView.View = View.Details;
            AddProcessInfo(ref TargetListView);

            TargetListView.EndUpdate();
        }
开发者ID:havien,项目名称:ProcessMonitor,代码行数:11,代码来源:ProcessListForm.cs

示例3: ResizeColumns

        private void ResizeColumns(ListView lvSource)
        {
            int iTotWidth = lvSource.Width;

            lvSource.BeginUpdate();
            lvDetails.Columns[0].Width = lvDetails.Width / 2;
            lvDetails.Columns[1].Width = lvDetails.Width / 2;
            lvSource.EndUpdate();
            lvSource.Update();
        }
开发者ID:MickaelE,项目名称:DaBCoS9,代码行数:10,代码来源:FormDetail.cs

示例4: UpdateListView

 private void UpdateListView(ListView view, ListViewItem item)
 {
     if (view.InvokeRequired)
     {
         view.BeginInvoke(new Action<ListView, ListViewItem>(UpdateListView), view, item);
     }
     else
     {
         view.Items.Add(item);
         if (view.Items.Count > 10)
             view.TopItem = view.Items[view.Items.Count - 10];
         view.Update();
         view.Parent.Update();
     }
 }
开发者ID:hmanjarawala,项目名称:GitRepo,代码行数:15,代码来源:frmEmailAutoMation.cs

示例5: AddItemToListView

 private void AddItemToListView(ListView lv, ListViewItem lvItem)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.labelStatus.InvokeRequired)
     {
         AddItemToListViewCallback d = new AddItemToListViewCallback(AddItemToListView);
         this.Invoke(d, new object[] { lv, lvItem });
     }
     else
     {
         lv.Items.Add(lvItem);
         lv.Update();
     }
 }
开发者ID:KibodWapon,项目名称:EmailAccountsChecker,代码行数:16,代码来源:Form1.cs


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